1/*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24
25/*
26 * This file contains ten different sub-tests.  Each sub-test consists of a
27 * class with a different case of an invalid duplicate attribute.  The main
28 * test runs each of these tests individually.  If any of them fail then the
29 * whole test fails.
30 */
31
32
33
34/*
35 * This test contains a class with invalid duplicate AnnotationDefault attributes.
36 */
37class AnnotationDefaultDup {
38  0xCAFEBABE;
39  0; // minor version
40  52; // version
41  [] { // Constant Pool
42    ; // first element is empty
43    Method #3 #11; // #1
44    class #12; // #2
45    class #13; // #3
46    Utf8 "<init>"; // #4
47    Utf8 "()V"; // #5
48    Utf8 "Code"; // #6
49    Utf8 "Signature"; // #7
50    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
51    Utf8 "AnnotationDefault"; // #9
52    Utf8 "LAnnotationDefaultI;"; // #10
53    NameAndType #4 #5; // #11
54    Utf8 "AnnotationDefaultDup"; // #12
55    Utf8 "java/lang/Object"; // #13
56    Utf8 "run"; // #14
57    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
58    NameAndType #14 #15; // #16
59    class #19; // #17
60    Method #17 #16; // #18
61    Utf8 "AnnotationDefaultDupChecker"; // #19
62  } // Constant Pool
63
64  0x0021; // access
65  #2;// this_cpx
66  #3;// super_cpx
67
68  [] { // Interfaces
69  } // Interfaces
70
71  [] { // fields
72  } // fields
73
74  [] { // methods
75    { // Member
76      0x0001; // access
77      #4; // name_cpx
78      #5; // sig_cpx
79      [] { // Attributes
80        Attr(#6) { // Code
81          1; // max_stack
82          1; // max_locals
83          Bytes[]{
84            0x2AB70001B1;
85          };
86          [] { // Traps
87          } // end Traps
88          [] { // Attributes
89          } // Attributes
90        } // end Code
91        ;
92
93        Attr(#9) { // AnnotationDefault
94          [] { // type annotations
95            { // type annotation
96              0x00;  // target_type
97              0x00;  // type_parameter_index
98              []b { //  type_path
99              }
100
101              #10; // type_index
102              [] { // element_value_pairs
103              } // element_value_pairs
104            } // type annotation
105          } // type annotations
106        } // end AnnotationDefault
107    // wrong:
108        ;
109        Attr(#9) { // AnnotationDefault
110          [] { // type annotations
111            { // type annotation
112              0x00;  // target_type
113              0x00;  // type_parameter_index
114              []b { //  type_path
115              }
116
117              #10; // type_index
118              [] { // element_value_pairs
119              } // element_value_pairs
120            } // type annotation
121          } // type annotations
122        } // end AnnotationDefault
123      } // Attributes
124    } // Member
125    ;
126    { // Member
127      0x0009; // access
128      #14; // name_cpx
129      #15; // sig_cpx
130      [] { // Attributes
131        Attr(#6) { // Code
132          2; // max_stack
133          2; // max_locals
134          Bytes[]{
135            0x2A2BB80012AC;
136          };
137          [] { // Traps
138          } // end Traps
139          [] { // Attributes
140          } // Attributes
141        } // end Code
142      } // Attributes
143    } // Member
144  } // methods
145
146  [] { // Attributes
147    Attr(#7) { // Signature
148      #8;
149    } // end Signature
150    ;
151    Attr(#9) { // AnnotationDefault
152      [] { // type annotations
153        { // type annotation
154          0x00;  // target_type
155          0x00;  // type_parameter_index
156          []b { //  type_path
157          }
158
159          #10; // type_index
160          [] { // element_value_pairs
161          } // element_value_pairs
162        } // type annotation
163      } // type annotations
164    } // end AnnotationDefault
165  } // Attributes
166
167} // end class
168
169
170
171/*
172 * This test contains a class with invalid duplicate RuntimeInvisibleAnnotations
173 * attributes.
174 */
175class ClassInvisAnnotsDup {
176  0xCAFEBABE;
177  0; // minor version
178  52; // version
179  [] { // Constant Pool
180    ; // first element is empty
181    Method #3 #11; // #1
182    class #12; // #2
183    class #13; // #3
184    Utf8 "<init>"; // #4
185    Utf8 "()V"; // #5
186    Utf8 "Code"; // #6
187    Utf8 "Signature"; // #7
188    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
189    Utf8 "RuntimeInvisibleAnnotations"; // #9
190    Utf8 "LClassInvisAnnotsI;"; // #10
191    NameAndType #4 #5; // #11
192    Utf8 "ClassInvisAnnotsDup"; // #12
193    Utf8 "java/lang/Object"; // #13
194    Utf8 "run"; // #14
195    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
196    NameAndType #14 #15; // #16
197    class #19; // #17
198    Method #17 #16; // #18
199    Utf8 "ClassInvisAnnotsDupChecker"; // #19
200  } // Constant Pool
201
202  0x0021; // access
203  #2;// this_cpx
204  #3;// super_cpx
205
206  [] { // Interfaces
207  } // Interfaces
208
209  [] { // fields
210  } // fields
211
212  [] { // methods
213    { // Member
214      0x0001; // access
215      #4; // name_cpx
216      #5; // sig_cpx
217      [] { // Attributes
218        Attr(#6) { // Code
219          1; // max_stack
220          1; // max_locals
221          Bytes[]{
222            0x2AB70001B1;
223          };
224          [] { // Traps
225          } // end Traps
226          [] { // Attributes
227          } // Attributes
228        } // end Code
229      } // Attributes
230    } // Member
231    ;
232    { // Member
233      0x0009; // access
234      #14; // name_cpx
235      #15; // sig_cpx
236      [] { // Attributes
237        Attr(#6) { // Code
238          2; // max_stack
239          2; // max_locals
240          Bytes[]{
241            0x2A2BB80012AC;
242          };
243          [] { // Traps
244          } // end Traps
245          [] { // Attributes
246          } // Attributes
247        } // end Code
248      } // Attributes
249    } // Member
250  } // methods
251
252  [] { // Attributes
253    Attr(#7) { // Signature
254      #8;
255    } // end Signature
256    ;
257    Attr(#9) { // RuntimeInvisibleAnnotations
258      [] { // type annotations
259        { // type annotation
260          0x00;  // target_type
261          0x00;  // type_parameter_index
262          []b { //  type_path
263          }
264
265          #10; // type_index
266          [] { // element_value_pairs
267          } // element_value_pairs
268        } // type annotation
269      } // type annotations
270    } // end RuntimeInvisibleAnnotations
271// wrong:
272    ;
273    Attr(#9) { // RuntimeInvisibleAnnotations
274      [] { // type annotations
275        { // type annotation
276          0x00;  // target_type
277          0x00;  // type_parameter_index
278          []b { //  type_path
279          }
280
281          #10; // type_index
282          [] { // element_value_pairs
283          } // element_value_pairs
284        } // type annotation
285      } // type annotations
286    } // end RuntimeInvisibleAnnotations
287// end wrong
288  } // Attributes
289
290} // end class
291
292
293
294/*
295 * This test contains a class with invalid duplicate RuntimeVisibleAnnotations
296 * attributes.
297 */
298class ClassVisAnnotsDup {
299  0xCAFEBABE;
300  0; // minor version
301  52; // version
302  [] { // Constant Pool
303    ; // first element is empty
304    Method #3 #11; // #1
305    class #12; // #2
306    class #13; // #3
307    Utf8 "<init>"; // #4
308    Utf8 "()V"; // #5
309    Utf8 "Code"; // #6
310    Utf8 "Signature"; // #7
311    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
312    Utf8 "RuntimeVisibleAnnotations"; // #9
313    Utf8 "LClassVisAnnotsI;"; // #10
314    NameAndType #4 #5; // #11
315    Utf8 "ClassVisAnnotsDup"; // #12
316    Utf8 "java/lang/Object"; // #13
317    Utf8 "run"; // #14
318    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
319    NameAndType #14 #15; // #16
320    class #19; // #17
321    Method #17 #16; // #18
322    Utf8 "ClassVisAnnotsDupChecker"; // #19
323  } // Constant Pool
324
325  0x0021; // access
326  #2;// this_cpx
327  #3;// super_cpx
328
329  [] { // Interfaces
330  } // Interfaces
331
332  [] { // fields
333  } // fields
334
335  [] { // methods
336    { // Member
337      0x0001; // access
338      #4; // name_cpx
339      #5; // sig_cpx
340      [] { // Attributes
341        Attr(#6) { // Code
342          1; // max_stack
343          1; // max_locals
344          Bytes[]{
345            0x2AB70001B1;
346          };
347          [] { // Traps
348          } // end Traps
349          [] { // Attributes
350          } // Attributes
351        } // end Code
352      } // Attributes
353    } // Member
354    ;
355    { // Member
356      0x0009; // access
357      #14; // name_cpx
358      #15; // sig_cpx
359      [] { // Attributes
360        Attr(#6) { // Code
361          2; // max_stack
362          2; // max_locals
363          Bytes[]{
364            0x2A2BB80012AC;
365          };
366          [] { // Traps
367          } // end Traps
368          [] { // Attributes
369          } // Attributes
370        } // end Code
371      } // Attributes
372    } // Member
373  } // methods
374
375  [] { // Attributes
376    Attr(#7) { // Signature
377      #8;
378    } // end Signature
379    ;
380    Attr(#9) { // RuntimeVisibleAnnotations
381      [] { // type annotations
382        { // type annotation
383          0x00;  // target_type
384          0x00;  // type_parameter_index
385          []b { //  type_path
386          }
387
388          #10; // type_index
389          [] { // element_value_pairs
390          } // element_value_pairs
391        } // type annotation
392      } // type annotations
393    } // end RuntimeVisibleAnnotations
394// wrong:
395    ;
396    Attr(#9) { // RuntimeVisibleAnnotations
397      [] { // type annotations
398        { // type annotation
399          0x00;  // target_type
400          0x00;  // type_parameter_index
401          []b { //  type_path
402          }
403
404          #10; // type_index
405          [] { // element_value_pairs
406          } // element_value_pairs
407        } // type annotation
408      } // type annotations
409    } // end RuntimeVisibleAnnotations
410// end wrong
411  } // Attributes
412
413} // end class
414
415
416
417/*
418 * This test contains a field with invalid duplicate RuntimeInvisibleAnnotations
419 * attributes.
420 */
421class FieldInvisAnnotsDup {
422  0xCAFEBABE;
423  0; // minor version
424  52; // version
425  [] { // Constant Pool
426    ; // first element is empty
427    Method #4 #16; // #1
428    Method #17 #18; // #2
429    class #19; // #3
430    class #20; // #4
431    Utf8 "fld"; // #5
432    Utf8 "Ljava/util/ArrayList;"; // #6
433    Utf8 "Signature"; // #7
434    Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
435    Utf8 "RuntimeInvisibleAnnotations"; // #9
436    Utf8 "LFieldInvisAnnotsI;"; // #10
437    Utf8 "<init>"; // #11
438    Utf8 "()V"; // #12
439    Utf8 "Code"; // #13
440    Utf8 "run"; // #14
441    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
442    NameAndType #11 #12; // #16
443    class #21; // #17
444    NameAndType #14 #15; // #18
445    Utf8 "FieldInvisAnnotsDup"; // #19
446    Utf8 "java/lang/Object"; // #20
447    Utf8 "FieldInvisAnnotsDupChecker"; // #21
448  } // Constant Pool
449
450  0x0021; // access
451  #3;// this_cpx
452  #4;// super_cpx
453
454  [] { // Interfaces
455  } // Interfaces
456
457  [] { // fields
458    { // Member
459      0x0001; // access
460      #5; // name_cpx
461      #6; // sig_cpx
462      [] { // Attributes
463        Attr(#7) { // Signature
464          #8;
465        } // end Signature
466        ;
467        Attr(#9) { // RuntimeInvisibleAnnotations
468          [] { // type annotations
469            { // type annotation
470              0x00;  // target_type
471              0x00;  // type_parameter_index
472              []b { //  type_path
473              }
474
475              #10; // type_index
476              [] { // element_value_pairs
477              } // element_value_pairs
478            } // type annotation
479          } // type annotations
480        } // end RuntimeInvisibleAnnotations
481    // wrong:
482        ;
483        Attr(#9) { // RuntimeInvisibleAnnotations
484          [] { // type annotations
485            { // type annotation
486              0x00;  // target_type
487              0x00;  // type_parameter_index
488              []b { //  type_path
489              }
490
491              #10; // type_index
492              [] { // element_value_pairs
493              } // element_value_pairs
494            } // type annotation
495          } // type annotations
496        } // end RuntimeInvisibleAnnotations
497    // end wrong
498      } // Attributes
499    } // Member
500  } // fields
501
502  [] { // methods
503    { // Member
504      0x0001; // access
505      #11; // name_cpx
506      #12; // sig_cpx
507      [] { // Attributes
508        Attr(#13) { // Code
509          1; // max_stack
510          1; // max_locals
511          Bytes[]{
512            0x2AB70001B1;
513          };
514          [] { // Traps
515          } // end Traps
516          [] { // Attributes
517          } // Attributes
518        } // end Code
519      } // Attributes
520    } // Member
521    ;
522    { // Member
523      0x0009; // access
524      #14; // name_cpx
525      #15; // sig_cpx
526      [] { // Attributes
527        Attr(#13) { // Code
528          2; // max_stack
529          2; // max_locals
530          Bytes[]{
531            0x2A2BB80002AC;
532          };
533          [] { // Traps
534          } // end Traps
535          [] { // Attributes
536          } // Attributes
537        } // end Code
538      } // Attributes
539    } // Member
540  } // methods
541
542  [] { // Attributes
543  } // Attributes
544} // end class
545
546
547
548/*
549 * This test contains a field with invalid duplicate RuntimeVisibleAnnotations
550 * attributes.
551 */
552class FieldVisAnnotsDup {
553  0xCAFEBABE;
554  0; // minor version
555  52; // version
556  [] { // Constant Pool
557    ; // first element is empty
558    Method #4 #16; // #1
559    Method #17 #18; // #2
560    class #19; // #3
561    class #20; // #4
562    Utf8 "fld"; // #5
563    Utf8 "Ljava/util/ArrayList;"; // #6
564    Utf8 "Signature"; // #7
565    Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
566    Utf8 "RuntimeVisibleAnnotations"; // #9
567    Utf8 "LFieldVisAnnotsI;"; // #10
568    Utf8 "<init>"; // #11
569    Utf8 "()V"; // #12
570    Utf8 "Code"; // #13
571    Utf8 "run"; // #14
572    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
573    NameAndType #11 #12; // #16
574    class #21; // #17
575    NameAndType #14 #15; // #18
576    Utf8 "FieldVisAnnotsDup"; // #19
577    Utf8 "java/lang/Object"; // #20
578    Utf8 "FieldVisAnnotsDupChecker"; // #21
579  } // Constant Pool
580
581  0x0021; // access
582  #3;// this_cpx
583  #4;// super_cpx
584
585  [] { // Interfaces
586  } // Interfaces
587
588  [] { // fields
589    { // Member
590      0x0001; // access
591      #5; // name_cpx
592      #6; // sig_cpx
593      [] { // Attributes
594        Attr(#7) { // Signature
595          #8;
596        } // end Signature
597        ;
598        Attr(#9) { // RuntimeVisibleAnnotations
599          [] { // type annotations
600            { // type annotation
601              0x00;  // target_type
602              0x00;  // type_parameter_index
603              []b { //  type_path
604              }
605
606              #10; // type_index
607              [] { // element_value_pairs
608              } // element_value_pairs
609            } // type annotation
610          } // type annotations
611        } // end RuntimeVisibleAnnotations
612    // wrong:
613        ;
614        Attr(#9) { // RuntimeVisibleAnnotations
615          [] { // type annotations
616            { // type annotation
617              0x00;  // target_type
618              0x00;  // type_parameter_index
619              []b { //  type_path
620              }
621
622              #10; // type_index
623              [] { // element_value_pairs
624              } // element_value_pairs
625            } // type annotation
626          } // type annotations
627        } // end RuntimeVisibleAnnotations
628    // end wrong
629      } // Attributes
630    } // Member
631  } // fields
632
633  [] { // methods
634    { // Member
635      0x0001; // access
636      #11; // name_cpx
637      #12; // sig_cpx
638      [] { // Attributes
639        Attr(#13) { // Code
640          1; // max_stack
641          1; // max_locals
642          Bytes[]{
643            0x2AB70001B1;
644          };
645          [] { // Traps
646          } // end Traps
647          [] { // Attributes
648          } // Attributes
649        } // end Code
650      } // Attributes
651    } // Member
652    ;
653    { // Member
654      0x0009; // access
655      #14; // name_cpx
656      #15; // sig_cpx
657      [] { // Attributes
658        Attr(#13) { // Code
659          2; // max_stack
660          2; // max_locals
661          Bytes[]{
662            0x2A2BB80002AC;
663          };
664          [] { // Traps
665          } // end Traps
666          [] { // Attributes
667          } // Attributes
668        } // end Code
669      } // Attributes
670    } // Member
671  } // methods
672
673  [] { // Attributes
674  } // Attributes
675} // end class
676
677
678
679/*
680 * This test contains a method with invalid duplicate RuntimeInvisibleAnnotations
681 * attributes.
682 */
683class MethInvisAnnotsDup {
684  0xCAFEBABE;
685  0; // minor version
686  52; // version
687  [] { // Constant Pool
688    ; // first element is empty
689    Method #3 #11; // #1
690    class #12; // #2
691    class #13; // #3
692    Utf8 "<init>"; // #4
693    Utf8 "()V"; // #5
694    Utf8 "Code"; // #6
695    Utf8 "Signature"; // #7
696    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
697    Utf8 "RuntimeInvisibleAnnotations"; // #9
698    Utf8 "LMethInvisAnnotsI;"; // #10
699    NameAndType #4 #5; // #11
700    Utf8 "MethInvisAnnotsDup"; // #12
701    Utf8 "java/lang/Object"; // #13
702    Utf8 "run"; // #14
703    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
704    NameAndType #14 #15; // #16
705    class #19; // #17
706    Method #17 #16; // #18
707    Utf8 "MethInvisAnnotsDupChecker"; // #19
708  } // Constant Pool
709
710  0x0021; // access
711  #2;// this_cpx
712  #3;// super_cpx
713
714  [] { // Interfaces
715  } // Interfaces
716
717  [] { // fields
718  } // fields
719
720  [] { // methods
721    { // Member
722      0x0001; // access
723      #4; // name_cpx
724      #5; // sig_cpx
725      [] { // Attributes
726        Attr(#6) { // Code
727          1; // max_stack
728          1; // max_locals
729          Bytes[]{
730            0x2AB70001B1;
731          };
732          [] { // Traps
733          } // end Traps
734          [] { // Attributes
735          } // Attributes
736        } // end Code
737        ;
738
739        Attr(#9) { // RuntimeInvisibleAnnotations
740          [] { // type annotations
741            { // type annotation
742              0x00;  // target_type
743              0x00;  // type_parameter_index
744              []b { //  type_path
745              }
746
747              #10; // type_index
748              [] { // element_value_pairs
749              } // element_value_pairs
750            } // type annotation
751          } // type annotations
752        } // end RuntimeInvisibleAnnotations
753    // wrong:
754        ;
755        Attr(#9) { // RuntimeInvisibleAnnotations
756          [] { // type annotations
757            { // type annotation
758              0x00;  // target_type
759              0x00;  // type_parameter_index
760              []b { //  type_path
761              }
762
763              #10; // type_index
764              [] { // element_value_pairs
765              } // element_value_pairs
766            } // type annotation
767          } // type annotations
768        } // end RuntimeInvisibleAnnotations
769      } // Attributes
770    } // Member
771    ;
772    { // Member
773      0x0009; // access
774      #14; // name_cpx
775      #15; // sig_cpx
776      [] { // Attributes
777        Attr(#6) { // Code
778          2; // max_stack
779          2; // max_locals
780          Bytes[]{
781            0x2A2BB80012AC;
782          };
783          [] { // Traps
784          } // end Traps
785          [] { // Attributes
786          } // Attributes
787        } // end Code
788      } // Attributes
789    } // Member
790  } // methods
791
792  [] { // Attributes
793    Attr(#7) { // Signature
794      #8;
795    } // end Signature
796    ;
797    Attr(#9) { // RuntimeInvisibleAnnotations
798      [] { // type annotations
799        { // type annotation
800          0x00;  // target_type
801          0x00;  // type_parameter_index
802          []b { //  type_path
803          }
804
805          #10; // type_index
806          [] { // element_value_pairs
807          } // element_value_pairs
808        } // type annotation
809      } // type annotations
810    } // end RuntimeInvisibleAnnotations
811  } // Attributes
812
813} // end class
814
815
816
817/*
818 * This test contains a method with invalid duplicate
819 * RuntimeInvisibleParameterAnnotations attributes.
820 */
821class MethInvisParamAnnotsDup {
822  0xCAFEBABE;
823  0; // minor version
824  52; // version
825  [] { // Constant Pool
826    ; // first element is empty
827    Method #4 #16; // #1
828    Method #17 #18; // #2
829    class #19; // #3
830    class #20; // #4
831    Utf8 "<init>"; // #5
832    Utf8 "()V"; // #6
833    Utf8 "Code"; // #7
834    Utf8 "m"; // #8
835    Utf8 "()I"; // #9
836    Utf8 "Signature"; // #10
837    Utf8 "<T:Ljava/lang/Object;>()I"; // #11
838    Utf8 "RuntimeInvisibleParameterAnnotations"; // #12
839    Utf8 "LMethInvisParamAnnotsI;"; // #13
840    Utf8 "run"; // #14
841    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
842    NameAndType #5 #6; // #16
843    class #21; // #17
844    NameAndType #14 #15; // #18
845    Utf8 "MethInvisParamAnnotsDup"; // #19
846    Utf8 "java/lang/Object"; // #20
847    Utf8 "MethInvisParamAnnotsDupChecker"; // #21
848  } // Constant Pool
849
850  0x0021; // access
851  #3;// this_cpx
852  #4;// super_cpx
853
854  [] { // Interfaces
855  } // Interfaces
856
857  [] { // fields
858  } // fields
859
860  [] { // methods
861    { // Member
862      0x0001; // access
863      #5; // name_cpx
864      #6; // sig_cpx
865      [] { // Attributes
866        Attr(#7) { // Code
867          1; // max_stack
868          1; // max_locals
869          Bytes[]{
870            0x2AB70001B1;
871          };
872          [] { // Traps
873          } // end Traps
874          [] { // Attributes
875          } // Attributes
876        } // end Code
877      } // Attributes
878    } // Member
879    ;
880    { // Member
881      0x0001; // access
882      #8; // name_cpx
883      #9; // sig_cpx
884      [] { // Attributes
885        Attr(#7) { // Code
886          1; // max_stack
887          1; // max_locals
888          Bytes[]{
889            0x03AC;
890          };
891          [] { // Traps
892          } // end Traps
893          [] { // Attributes
894          } // Attributes
895        } // end Code
896        ;
897        Attr(#10) { // Signature
898          #11;
899        } // end Signature
900        ;
901        Attr(#12) { // RuntimeInvisibleParameterAnnotations
902          0x0001010000000D00;
903          0x00;
904        } // end RuntimeInvisibleParameterAnnotations
905// wrong:
906        ;
907        Attr(#12) { // RuntimeInvisibleParameterAnnotations
908          0x0001010000000D00;
909          0x00;
910        } // end RuntimeInvisibleParameterAnnotations
911// end wrong
912      } // Attributes
913    } // Member
914    ;
915    { // Member
916      0x0009; // access
917      #14; // name_cpx
918      #15; // sig_cpx
919      [] { // Attributes
920        Attr(#7) { // Code
921          2; // max_stack
922          2; // max_locals
923          Bytes[]{
924            0x2A2BB80002AC;
925          };
926          [] { // Traps
927          } // end Traps
928          [] { // Attributes
929          } // Attributes
930        } // end Code
931      } // Attributes
932    } // Member
933  } // methods
934
935  [] { // Attributes
936  } // Attributes
937} // end class
938
939
940
941/*
942 * This test contains a method with invalid duplicate RuntimeVisibleAnnotations
943 * attributes.
944 */
945class MethVisAnnotsDup {
946  0xCAFEBABE;
947  0; // minor version
948  52; // version
949  [] { // Constant Pool
950    ; // first element is empty
951    Method #3 #11; // #1
952    class #12; // #2
953    class #13; // #3
954    Utf8 "<init>"; // #4
955    Utf8 "()V"; // #5
956    Utf8 "Code"; // #6
957    Utf8 "Signature"; // #7
958    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
959    Utf8 "RuntimeVisibleAnnotations"; // #9
960    Utf8 "LMethodVisAnnotsDupI;"; // #10
961    NameAndType #4 #5; // #11
962    Utf8 "MethVisAnnotsDup"; // #12
963    Utf8 "java/lang/Object"; // #13
964    Utf8 "run"; // #14
965    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
966    NameAndType #14 #15; // #16
967    class #19; // #17
968    Method #17 #16; // #18
969    Utf8 "MethVisAnnotsDupChecker"; // #19
970  } // Constant Pool
971
972  0x0021; // access
973  #2;// this_cpx
974  #3;// super_cpx
975
976  [] { // Interfaces
977  } // Interfaces
978
979  [] { // fields
980  } // fields
981
982  [] { // methods
983    { // Member
984      0x0001; // access
985      #4; // name_cpx
986      #5; // sig_cpx
987      [] { // Attributes
988        Attr(#6) { // Code
989          1; // max_stack
990          1; // max_locals
991          Bytes[]{
992            0x2AB70001B1;
993          };
994          [] { // Traps
995          } // end Traps
996          [] { // Attributes
997          } // Attributes
998        } // end Code
999        ;
1000
1001        Attr(#9) { // RuntimeVisibleAnnotations
1002          [] { // type annotations
1003            { // type annotation
1004              0x00;  // target_type
1005              0x00;  // type_parameter_index
1006              []b { //  type_path
1007              }
1008
1009              #10; // type_index
1010              [] { // element_value_pairs
1011              } // element_value_pairs
1012            } // type annotation
1013          } // type annotations
1014        } // end RuntimeVisibleAnnotations
1015    // wrong:
1016        ;
1017        Attr(#9) { // RuntimeVisibleAnnotations
1018          [] { // type annotations
1019            { // type annotation
1020              0x00;  // target_type
1021              0x00;  // type_parameter_index
1022              []b { //  type_path
1023              }
1024
1025              #10; // type_index
1026              [] { // element_value_pairs
1027              } // element_value_pairs
1028            } // type annotation
1029          } // type annotations
1030        } // end RuntimeVisibleAnnotations
1031      } // Attributes
1032    } // Member
1033    ;
1034    { // Member
1035      0x0009; // access
1036      #14; // name_cpx
1037      #15; // sig_cpx
1038      [] { // Attributes
1039        Attr(#6) { // Code
1040          2; // max_stack
1041          2; // max_locals
1042          Bytes[]{
1043            0x2A2BB80012AC;
1044          };
1045          [] { // Traps
1046          } // end Traps
1047          [] { // Attributes
1048          } // Attributes
1049        } // end Code
1050      } // Attributes
1051    } // Member
1052  } // methods
1053
1054  [] { // Attributes
1055    Attr(#7) { // Signature
1056      #8;
1057    } // end Signature
1058    ;
1059    Attr(#9) { // RuntimeVisibleAnnotations
1060      [] { // type annotations
1061        { // type annotation
1062          0x00;  // target_type
1063          0x00;  // type_parameter_index
1064          []b { //  type_path
1065          }
1066
1067          #10; // type_index
1068          [] { // element_value_pairs
1069          } // element_value_pairs
1070        } // type annotation
1071      } // type annotations
1072    } // end RuntimeVisibleAnnotations
1073  } // Attributes
1074
1075} // end class
1076
1077
1078
1079/*
1080 * This test contains a method with invalid duplicate
1081 * RuntimeVisibleParameterAnnotations attributes.
1082 */
1083class MethVisParamAnnotsDup {
1084  0xCAFEBABE;
1085  0; // minor version
1086  52; // version
1087  [] { // Constant Pool
1088    ; // first element is empty
1089    Method #4 #16; // #1
1090    Method #17 #18; // #2
1091    class #19; // #3
1092    class #20; // #4
1093    Utf8 "<init>"; // #5
1094    Utf8 "()V"; // #6
1095    Utf8 "Code"; // #7
1096    Utf8 "m"; // #8
1097    Utf8 "()I"; // #9
1098    Utf8 "Signature"; // #10
1099    Utf8 "<T:Ljava/lang/Object;>()I"; // #11
1100    Utf8 "RuntimeVisibleParameterAnnotations"; // #12
1101    Utf8 "LMethVisParamAnnotsI;"; // #13
1102    Utf8 "run"; // #14
1103    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
1104    NameAndType #5 #6; // #16
1105    class #21; // #17
1106    NameAndType #14 #15; // #18
1107    Utf8 "MethVisParamAnnotsDup"; // #19
1108    Utf8 "java/lang/Object"; // #20
1109    Utf8 "MethVisParamAnnotsDupChecker"; // #21
1110  } // Constant Pool
1111
1112  0x0021; // access
1113  #3;// this_cpx
1114  #4;// super_cpx
1115
1116  [] { // Interfaces
1117  } // Interfaces
1118
1119  [] { // fields
1120  } // fields
1121
1122  [] { // methods
1123    { // Member
1124      0x0001; // access
1125      #5; // name_cpx
1126      #6; // sig_cpx
1127      [] { // Attributes
1128        Attr(#7) { // Code
1129          1; // max_stack
1130          1; // max_locals
1131          Bytes[]{
1132            0x2AB70001B1;
1133          };
1134          [] { // Traps
1135          } // end Traps
1136          [] { // Attributes
1137          } // Attributes
1138        } // end Code
1139      } // Attributes
1140    } // Member
1141    ;
1142    { // Member
1143      0x0001; // access
1144      #8; // name_cpx
1145      #9; // sig_cpx
1146      [] { // Attributes
1147        Attr(#7) { // Code
1148          1; // max_stack
1149          1; // max_locals
1150          Bytes[]{
1151            0x03AC;
1152          };
1153          [] { // Traps
1154          } // end Traps
1155          [] { // Attributes
1156          } // Attributes
1157        } // end Code
1158        ;
1159        Attr(#10) { // Signature
1160          #11;
1161        } // end Signature
1162        ;
1163        Attr(#12) { // RuntimeVisibleParameterAnnotations
1164          0x0001010000000D00;
1165          0x00;
1166        } // end RuntimeVisibleParameterAnnotations
1167// wrong:
1168        ;
1169        Attr(#12) { // RuntimeVisibleParameterAnnotations
1170          0x0001010000000D00;
1171          0x00;
1172        } // end RuntimeVisibleParameterAnnotations
1173// end wrong
1174      } // Attributes
1175    } // Member
1176    ;
1177    { // Member
1178      0x0009; // access
1179      #14; // name_cpx
1180      #15; // sig_cpx
1181      [] { // Attributes
1182        Attr(#7) { // Code
1183          2; // max_stack
1184          2; // max_locals
1185          Bytes[]{
1186            0x2A2BB80002AC;
1187          };
1188          [] { // Traps
1189          } // end Traps
1190          [] { // Attributes
1191          } // Attributes
1192        } // end Code
1193      } // Attributes
1194    } // Member
1195  } // methods
1196
1197  [] { // Attributes
1198  } // Attributes
1199} // end class
1200
1201
1202
1203/*
1204 * This test contains a method with invalid duplicate SourceDebugExtension
1205 * attributes.
1206 */
1207class SrcDbgExtDup {
1208  0xCAFEBABE;
1209  0; // minor version
1210  52; // version
1211  [] { // Constant Pool
1212    ; // first element is empty
1213    Method #3 #11; // #1
1214    class #12; // #2
1215    class #13; // #3
1216    Utf8 "<init>"; // #4
1217    Utf8 "()V"; // #5
1218    Utf8 "Code"; // #6
1219    Utf8 "Signature"; // #7
1220    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
1221    Utf8 "SourceDebugExtension"; // #9
1222    Utf8 "LSrcDbgExtDupI;"; // #10
1223    NameAndType #4 #5; // #11
1224    Utf8 "SrcDbgExtDup"; // #12
1225    Utf8 "java/lang/Object"; // #13
1226    Utf8 "run"; // #14
1227    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
1228    NameAndType #14 #15; // #16
1229    class #19; // #17
1230    Method #17 #16; // #18
1231    Utf8 "SrcDbgExt_dupChecker"; // #19
1232  } // Constant Pool
1233
1234  0x0021; // access
1235  #2;// this_cpx
1236  #3;// super_cpx
1237
1238  [] { // Interfaces
1239  } // Interfaces
1240
1241  [] { // fields
1242  } // fields
1243
1244  [] { // methods
1245    { // Member
1246      0x0001; // access
1247      #4; // name_cpx
1248      #5; // sig_cpx
1249      [] { // Attributes
1250        Attr(#6) { // Code
1251          1; // max_stack
1252          1; // max_locals
1253          Bytes[]{
1254            0x2AB70001B1;
1255          };
1256          [] { // Traps
1257          } // end Traps
1258          [] { // Attributes
1259          } // Attributes
1260        } // end Code
1261      } // Attributes
1262    } // Member
1263    ;
1264    { // Member
1265      0x0009; // access
1266      #14; // name_cpx
1267      #15; // sig_cpx
1268      [] { // Attributes
1269        Attr(#6) { // Code
1270          2; // max_stack
1271          2; // max_locals
1272          Bytes[]{
1273            0x2A2BB80012AC;
1274          };
1275          [] { // Traps
1276          } // end Traps
1277          [] { // Attributes
1278          } // Attributes
1279        } // end Code
1280      } // Attributes
1281    } // Member
1282  } // methods
1283
1284  [] { // Attributes
1285    Attr(#7) { // Signature
1286      #8;
1287    } // end Signature
1288    ;
1289    Attr(#9) { // SourceDebugExtension
1290      [] { // debug_extensions
1291        { // type debug_extension
1292          []b { //  type_path
1293          }
1294        } // type debug_extension
1295      } // type debug_extensions
1296    } // end SourceDebugExtension
1297// wrong:
1298    ;
1299    Attr(#9) { // SourceDebugExtension
1300      [] { // debug_extensions
1301        { // type debug_extension
1302          []b { //  type_path
1303          }
1304        } // type debug_extension
1305      } // type debug_extensions
1306    } // end SourceDebugExtension
1307// end wrong
1308  } // Attributes
1309
1310} // end class
1311