1 /*
   2  * Copyright (c) 2017, 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 /* Source: NestmateAttributeHolder.java
  25 
  26 public class NestmateAttributeHolder {
  27     public static class TwoNestHost {
  28     }
  29 }
  30 */
  31 
  32 // Add NestHost attribute to nest-host class - conflicting attributes
  33 
  34 class ConflictingAttributesInNestHost {
  35   0xCAFEBABE;
  36   0; // minor version
  37   53; // version
  38   [] { // Constant Pool
  39     ; // first element is empty
  40     Method #3 #14; // #1
  41     class #15; // #2
  42     class #16; // #3
  43     class #17; // #4
  44     Utf8 "TwoNestHost"; // #5
  45     Utf8 "InnerClasses"; // #6
  46     Utf8 "<init>"; // #7
  47     Utf8 "()V"; // #8
  48     Utf8 "Code"; // #9
  49     Utf8 "LineNumberTable"; // #10
  50     Utf8 "SourceFile"; // #11
  51     Utf8 "ConflictingAttributesInNestHost.java"; // #12
  52     Utf8 "NestMembers"; // #13
  53     NameAndType #7 #8; // #14
  54     Utf8 "ConflictingAttributesInNestHost"; // #15
  55     Utf8 "java/lang/Object"; // #16
  56     Utf8 "ConflictingAttributesInNestHost$TwoNestHost"; // #17
  57     Utf8 "NestHost"; // #18
  58   } // Constant Pool
  59 
  60   0x0021; // access
  61   #2;// this_cpx
  62   #3;// super_cpx
  63 
  64   [] { // Interfaces
  65   } // Interfaces
  66 
  67   [] { // fields
  68   } // fields
  69 
  70   [] { // methods
  71     { // Member
  72       0x0001; // access
  73       #7; // name_cpx
  74       #8; // sig_cpx
  75       [] { // Attributes
  76         Attr(#9) { // Code
  77           1; // max_stack
  78           1; // max_locals
  79           Bytes[]{
  80             0x2AB70001B1;
  81           };
  82           [] { // Traps
  83           } // end Traps
  84           [] { // Attributes
  85             Attr(#10) { // LineNumberTable
  86               [] { // LineNumberTable
  87                 0  1;
  88               }
  89             } // end LineNumberTable
  90           } // Attributes
  91         } // end Code
  92       } // Attributes
  93     } // Member
  94   } // methods
  95 
  96   [] { // Attributes
  97     Attr(#11) { // SourceFile
  98       #12;
  99     } // end SourceFile
 100     ;
 101     Attr(#13) { // NestMembers
 102       0x00010004;
 103     } // end NestMembers
 104     ;
 105     // conflict - can't be a member of a nest and have nest members
 106     Attr(#18) { // NestHost
 107       0x0003; // #3 is Object
 108     } // end NestHost
 109     ;
 110     Attr(#6) { // InnerClasses
 111       [] { // InnerClasses
 112         #4 #2 #5 9;
 113       }
 114     } // end InnerClasses
 115   } // Attributes
 116 } // end class ConflictingAttributesInNestHost