3789983e89
Reviewed-by: darcy, ihse
1311 lines
31 KiB
Plaintext
1311 lines
31 KiB
Plaintext
/*
|
|
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
* accompanied this code).
|
|
*
|
|
* You should have received a copy of the GNU General Public License version
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
* questions.
|
|
*/
|
|
|
|
|
|
/*
|
|
* This file contains ten different sub-tests. Each sub-test consists of a
|
|
* class with a different case of an invalid duplicate attribute. The main
|
|
* test runs each of these tests individually. If any of them fail then the
|
|
* whole test fails.
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a class with invalid duplicate AnnotationDefault attributes.
|
|
*/
|
|
class AnnotationDefaultDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #3 #11; // #1
|
|
class #12; // #2
|
|
class #13; // #3
|
|
Utf8 "<init>"; // #4
|
|
Utf8 "()V"; // #5
|
|
Utf8 "Code"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
|
|
Utf8 "AnnotationDefault"; // #9
|
|
Utf8 "LAnnotationDefaultI;"; // #10
|
|
NameAndType #4 #5; // #11
|
|
Utf8 "AnnotationDefaultDup"; // #12
|
|
Utf8 "java/lang/Object"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #14 #15; // #16
|
|
class #19; // #17
|
|
Method #17 #16; // #18
|
|
Utf8 "AnnotationDefaultDupChecker"; // #19
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#2;// this_cpx
|
|
#3;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#4; // name_cpx
|
|
#5; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
;
|
|
|
|
Attr(#9) { // AnnotationDefault
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end AnnotationDefault
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // AnnotationDefault
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end AnnotationDefault
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80012AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // AnnotationDefault
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end AnnotationDefault
|
|
} // Attributes
|
|
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a class with invalid duplicate RuntimeInvisibleAnnotations
|
|
* attributes.
|
|
*/
|
|
class ClassInvisAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #3 #11; // #1
|
|
class #12; // #2
|
|
class #13; // #3
|
|
Utf8 "<init>"; // #4
|
|
Utf8 "()V"; // #5
|
|
Utf8 "Code"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
|
|
Utf8 "RuntimeInvisibleAnnotations"; // #9
|
|
Utf8 "LClassInvisAnnotsI;"; // #10
|
|
NameAndType #4 #5; // #11
|
|
Utf8 "ClassInvisAnnotsDup"; // #12
|
|
Utf8 "java/lang/Object"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #14 #15; // #16
|
|
class #19; // #17
|
|
Method #17 #16; // #18
|
|
Utf8 "ClassInvisAnnotsDupChecker"; // #19
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#2;// this_cpx
|
|
#3;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#4; // name_cpx
|
|
#5; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80012AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
// end wrong
|
|
} // Attributes
|
|
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a class with invalid duplicate RuntimeVisibleAnnotations
|
|
* attributes.
|
|
*/
|
|
class ClassVisAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #3 #11; // #1
|
|
class #12; // #2
|
|
class #13; // #3
|
|
Utf8 "<init>"; // #4
|
|
Utf8 "()V"; // #5
|
|
Utf8 "Code"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
|
|
Utf8 "RuntimeVisibleAnnotations"; // #9
|
|
Utf8 "LClassVisAnnotsI;"; // #10
|
|
NameAndType #4 #5; // #11
|
|
Utf8 "ClassVisAnnotsDup"; // #12
|
|
Utf8 "java/lang/Object"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #14 #15; // #16
|
|
class #19; // #17
|
|
Method #17 #16; // #18
|
|
Utf8 "ClassVisAnnotsDupChecker"; // #19
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#2;// this_cpx
|
|
#3;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#4; // name_cpx
|
|
#5; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80012AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
// end wrong
|
|
} // Attributes
|
|
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a field with invalid duplicate RuntimeInvisibleAnnotations
|
|
* attributes.
|
|
*/
|
|
class FieldInvisAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #4 #16; // #1
|
|
Method #17 #18; // #2
|
|
class #19; // #3
|
|
class #20; // #4
|
|
Utf8 "fld"; // #5
|
|
Utf8 "Ljava/util/ArrayList;"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
|
|
Utf8 "RuntimeInvisibleAnnotations"; // #9
|
|
Utf8 "LFieldInvisAnnotsI;"; // #10
|
|
Utf8 "<init>"; // #11
|
|
Utf8 "()V"; // #12
|
|
Utf8 "Code"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #11 #12; // #16
|
|
class #21; // #17
|
|
NameAndType #14 #15; // #18
|
|
Utf8 "FieldInvisAnnotsDup"; // #19
|
|
Utf8 "java/lang/Object"; // #20
|
|
Utf8 "FieldInvisAnnotsDupChecker"; // #21
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#3;// this_cpx
|
|
#4;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
{ // Member
|
|
0x0001; // access
|
|
#5; // name_cpx
|
|
#6; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
// end wrong
|
|
} // Attributes
|
|
} // Member
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#11; // name_cpx
|
|
#12; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#13) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#13) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80002AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a field with invalid duplicate RuntimeVisibleAnnotations
|
|
* attributes.
|
|
*/
|
|
class FieldVisAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #4 #16; // #1
|
|
Method #17 #18; // #2
|
|
class #19; // #3
|
|
class #20; // #4
|
|
Utf8 "fld"; // #5
|
|
Utf8 "Ljava/util/ArrayList;"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
|
|
Utf8 "RuntimeVisibleAnnotations"; // #9
|
|
Utf8 "LFieldVisAnnotsI;"; // #10
|
|
Utf8 "<init>"; // #11
|
|
Utf8 "()V"; // #12
|
|
Utf8 "Code"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #11 #12; // #16
|
|
class #21; // #17
|
|
NameAndType #14 #15; // #18
|
|
Utf8 "FieldVisAnnotsDup"; // #19
|
|
Utf8 "java/lang/Object"; // #20
|
|
Utf8 "FieldVisAnnotsDupChecker"; // #21
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#3;// this_cpx
|
|
#4;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
{ // Member
|
|
0x0001; // access
|
|
#5; // name_cpx
|
|
#6; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
// end wrong
|
|
} // Attributes
|
|
} // Member
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#11; // name_cpx
|
|
#12; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#13) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#13) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80002AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a method with invalid duplicate RuntimeInvisibleAnnotations
|
|
* attributes.
|
|
*/
|
|
class MethInvisAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #3 #11; // #1
|
|
class #12; // #2
|
|
class #13; // #3
|
|
Utf8 "<init>"; // #4
|
|
Utf8 "()V"; // #5
|
|
Utf8 "Code"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
|
|
Utf8 "RuntimeInvisibleAnnotations"; // #9
|
|
Utf8 "LMethInvisAnnotsI;"; // #10
|
|
NameAndType #4 #5; // #11
|
|
Utf8 "MethInvisAnnotsDup"; // #12
|
|
Utf8 "java/lang/Object"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #14 #15; // #16
|
|
class #19; // #17
|
|
Method #17 #16; // #18
|
|
Utf8 "MethInvisAnnotsDupChecker"; // #19
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#2;// this_cpx
|
|
#3;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#4; // name_cpx
|
|
#5; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
;
|
|
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80012AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // RuntimeInvisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeInvisibleAnnotations
|
|
} // Attributes
|
|
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a method with invalid duplicate
|
|
* RuntimeInvisibleParameterAnnotations attributes.
|
|
*/
|
|
class MethInvisParamAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #4 #16; // #1
|
|
Method #17 #18; // #2
|
|
class #19; // #3
|
|
class #20; // #4
|
|
Utf8 "<init>"; // #5
|
|
Utf8 "()V"; // #6
|
|
Utf8 "Code"; // #7
|
|
Utf8 "m"; // #8
|
|
Utf8 "()I"; // #9
|
|
Utf8 "Signature"; // #10
|
|
Utf8 "<T:Ljava/lang/Object;>()I"; // #11
|
|
Utf8 "RuntimeInvisibleParameterAnnotations"; // #12
|
|
Utf8 "LMethInvisParamAnnotsI;"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #5 #6; // #16
|
|
class #21; // #17
|
|
NameAndType #14 #15; // #18
|
|
Utf8 "MethInvisParamAnnotsDup"; // #19
|
|
Utf8 "java/lang/Object"; // #20
|
|
Utf8 "MethInvisParamAnnotsDupChecker"; // #21
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#3;// this_cpx
|
|
#4;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#5; // name_cpx
|
|
#6; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0001; // access
|
|
#8; // name_cpx
|
|
#9; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x03AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
;
|
|
Attr(#10) { // Signature
|
|
#11;
|
|
} // end Signature
|
|
;
|
|
Attr(#12) { // RuntimeInvisibleParameterAnnotations
|
|
0x0001010000000D00;
|
|
0x00;
|
|
} // end RuntimeInvisibleParameterAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#12) { // RuntimeInvisibleParameterAnnotations
|
|
0x0001010000000D00;
|
|
0x00;
|
|
} // end RuntimeInvisibleParameterAnnotations
|
|
// end wrong
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80002AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a method with invalid duplicate RuntimeVisibleAnnotations
|
|
* attributes.
|
|
*/
|
|
class MethVisAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #3 #11; // #1
|
|
class #12; // #2
|
|
class #13; // #3
|
|
Utf8 "<init>"; // #4
|
|
Utf8 "()V"; // #5
|
|
Utf8 "Code"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
|
|
Utf8 "RuntimeVisibleAnnotations"; // #9
|
|
Utf8 "LMethodVisAnnotsDupI;"; // #10
|
|
NameAndType #4 #5; // #11
|
|
Utf8 "MethVisAnnotsDup"; // #12
|
|
Utf8 "java/lang/Object"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #14 #15; // #16
|
|
class #19; // #17
|
|
Method #17 #16; // #18
|
|
Utf8 "MethVisAnnotsDupChecker"; // #19
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#2;// this_cpx
|
|
#3;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#4; // name_cpx
|
|
#5; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
;
|
|
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80012AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // RuntimeVisibleAnnotations
|
|
[] { // type annotations
|
|
{ // type annotation
|
|
0x00; // target_type
|
|
0x00; // type_parameter_index
|
|
[]b { // type_path
|
|
}
|
|
|
|
#10; // type_index
|
|
[] { // element_value_pairs
|
|
} // element_value_pairs
|
|
} // type annotation
|
|
} // type annotations
|
|
} // end RuntimeVisibleAnnotations
|
|
} // Attributes
|
|
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a method with invalid duplicate
|
|
* RuntimeVisibleParameterAnnotations attributes.
|
|
*/
|
|
class MethVisParamAnnotsDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #4 #16; // #1
|
|
Method #17 #18; // #2
|
|
class #19; // #3
|
|
class #20; // #4
|
|
Utf8 "<init>"; // #5
|
|
Utf8 "()V"; // #6
|
|
Utf8 "Code"; // #7
|
|
Utf8 "m"; // #8
|
|
Utf8 "()I"; // #9
|
|
Utf8 "Signature"; // #10
|
|
Utf8 "<T:Ljava/lang/Object;>()I"; // #11
|
|
Utf8 "RuntimeVisibleParameterAnnotations"; // #12
|
|
Utf8 "LMethVisParamAnnotsI;"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #5 #6; // #16
|
|
class #21; // #17
|
|
NameAndType #14 #15; // #18
|
|
Utf8 "MethVisParamAnnotsDup"; // #19
|
|
Utf8 "java/lang/Object"; // #20
|
|
Utf8 "MethVisParamAnnotsDupChecker"; // #21
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#3;// this_cpx
|
|
#4;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#5; // name_cpx
|
|
#6; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0001; // access
|
|
#8; // name_cpx
|
|
#9; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x03AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
;
|
|
Attr(#10) { // Signature
|
|
#11;
|
|
} // end Signature
|
|
;
|
|
Attr(#12) { // RuntimeVisibleParameterAnnotations
|
|
0x0001010000000D00;
|
|
0x00;
|
|
} // end RuntimeVisibleParameterAnnotations
|
|
// wrong:
|
|
;
|
|
Attr(#12) { // RuntimeVisibleParameterAnnotations
|
|
0x0001010000000D00;
|
|
0x00;
|
|
} // end RuntimeVisibleParameterAnnotations
|
|
// end wrong
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#7) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80002AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end class
|
|
|
|
|
|
|
|
/*
|
|
* This test contains a method with invalid duplicate SourceDebugExtension
|
|
* attributes.
|
|
*/
|
|
class SrcDbgExtDup {
|
|
0xCAFEBABE;
|
|
0; // minor version
|
|
52; // version
|
|
[] { // Constant Pool
|
|
; // first element is empty
|
|
Method #3 #11; // #1
|
|
class #12; // #2
|
|
class #13; // #3
|
|
Utf8 "<init>"; // #4
|
|
Utf8 "()V"; // #5
|
|
Utf8 "Code"; // #6
|
|
Utf8 "Signature"; // #7
|
|
Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
|
|
Utf8 "SourceDebugExtension"; // #9
|
|
Utf8 "LSrcDbgExtDupI;"; // #10
|
|
NameAndType #4 #5; // #11
|
|
Utf8 "SrcDbgExtDup"; // #12
|
|
Utf8 "java/lang/Object"; // #13
|
|
Utf8 "run"; // #14
|
|
Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
|
|
NameAndType #14 #15; // #16
|
|
class #19; // #17
|
|
Method #17 #16; // #18
|
|
Utf8 "SrcDbgExt_dupChecker"; // #19
|
|
} // Constant Pool
|
|
|
|
0x0021; // access
|
|
#2;// this_cpx
|
|
#3;// super_cpx
|
|
|
|
[] { // Interfaces
|
|
} // Interfaces
|
|
|
|
[] { // fields
|
|
} // fields
|
|
|
|
[] { // methods
|
|
{ // Member
|
|
0x0001; // access
|
|
#4; // name_cpx
|
|
#5; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
1; // max_stack
|
|
1; // max_locals
|
|
Bytes[]{
|
|
0x2AB70001B1;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
;
|
|
{ // Member
|
|
0x0009; // access
|
|
#14; // name_cpx
|
|
#15; // sig_cpx
|
|
[] { // Attributes
|
|
Attr(#6) { // Code
|
|
2; // max_stack
|
|
2; // max_locals
|
|
Bytes[]{
|
|
0x2A2BB80012AC;
|
|
};
|
|
[] { // Traps
|
|
} // end Traps
|
|
[] { // Attributes
|
|
} // Attributes
|
|
} // end Code
|
|
} // Attributes
|
|
} // Member
|
|
} // methods
|
|
|
|
[] { // Attributes
|
|
Attr(#7) { // Signature
|
|
#8;
|
|
} // end Signature
|
|
;
|
|
Attr(#9) { // SourceDebugExtension
|
|
[] { // debug_extensions
|
|
{ // type debug_extension
|
|
[]b { // type_path
|
|
}
|
|
} // type debug_extension
|
|
} // type debug_extensions
|
|
} // end SourceDebugExtension
|
|
// wrong:
|
|
;
|
|
Attr(#9) { // SourceDebugExtension
|
|
[] { // debug_extensions
|
|
{ // type debug_extension
|
|
[]b { // type_path
|
|
}
|
|
} // type debug_extension
|
|
} // type debug_extensions
|
|
} // end SourceDebugExtension
|
|
// end wrong
|
|
} // Attributes
|
|
|
|
} // end class
|