1 /*
   2  * Copyright (c) 2018, 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 // Modify NestMembers attribute to contain multiple duplicates
  25 
  26 class HostWithDuplicateMembers {
  27   0xCAFEBABE;
  28   0; // minor version
  29   55; // version
  30   [] { // Constant Pool
  31     ; // first element is empty
  32     Method #3 #16; // #1
  33     class #17; // #2
  34     class #18; // #3
  35     class #19; // #4
  36     Utf8 "Member2"; // #5
  37     Utf8 "InnerClasses"; // #6
  38     class #20; // #7
  39     Utf8 "Member1"; // #8
  40     Utf8 "<init>"; // #9
  41     Utf8 "()V"; // #10
  42     Utf8 "Code"; // #11
  43     Utf8 "LineNumberTable"; // #12
  44     Utf8 "SourceFile"; // #13
  45     Utf8 "Hosts.java"; // #14
  46     Utf8 "NestMembers"; // #15
  47     NameAndType #9 #10; // #16
  48     Utf8 "HostWithDuplicateMembers"; // #17
  49     Utf8 "java/lang/Object"; // #18
  50     Utf8 "HostWithDuplicateMembers$Member2"; // #19
  51     Utf8 "HostWithDuplicateMembers$Member1"; // #20
  52   } // Constant Pool
  53 
  54   0x0020; // access
  55   #2;// this_cpx
  56   #3;// super_cpx
  57 
  58   [] { // Interfaces
  59   } // Interfaces
  60 
  61   [] { // fields
  62   } // fields
  63 
  64   [] { // methods
  65     { // Member
  66       0x0000; // access
  67       #9; // name_cpx
  68       #10; // sig_cpx
  69       [] { // Attributes
  70         Attr(#11) { // Code
  71           1; // max_stack
  72           1; // max_locals
  73           Bytes[]{
  74             0x2AB70001B1;
  75           };
  76           [] { // Traps
  77           } // end Traps
  78           [] { // Attributes
  79             Attr(#12) { // LineNumberTable
  80               [] { // LineNumberTable
  81                 0  60;
  82               }
  83             } // end LineNumberTable
  84           } // Attributes
  85         } // end Code
  86       } // Attributes
  87     } // Member
  88   } // methods
  89 
  90   [] { // Attributes
  91     Attr(#13) { // SourceFile
  92       #14;
  93     } // end SourceFile
  94     ;
  95     Attr(#15) { // NestMembers
  96       0x0006000700040007;  // modified
  97       0x000400070004;
  98     } // end NestMembers
  99     ;
 100     Attr(#6) { // InnerClasses
 101       [] { // InnerClasses
 102         #4 #2 #5 1544;
 103         #7 #2 #8 8;
 104       }
 105     } // end InnerClasses
 106   } // Attributes
 107 } // end class HostWithDuplicateMembers