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 second NestMembers attribute - should fail parsing
  33 
  34 class NestmateAttributeHolder {
  35   0xCAFEBABE;
  36   0; // minor version
  37   54; // 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 "NestmateAttributeHolder.java"; // #12    
  52     Utf8 "NestMembers"; // #13    
  53     NameAndType #7 #8; // #14    
  54     Utf8 "NestmateAttributeHolder"; // #15    
  55     Utf8 "java/lang/Object"; // #16    
  56     Utf8 "NestmateAttributeHolder$TwoNestHost"; // #17    
  57   } // Constant Pool
  58 
  59   0x0021; // access
  60   #2;// this_cpx
  61   #3;// super_cpx
  62 
  63   [] { // Interfaces
  64   } // Interfaces
  65 
  66   [] { // fields
  67   } // fields
  68 
  69   [] { // methods
  70     { // Member
  71       0x0001; // access
  72       #7; // name_cpx
  73       #8; // sig_cpx
  74       [] { // Attributes
  75         Attr(#9) { // Code
  76           1; // max_stack
  77           1; // max_locals
  78           Bytes[]{
  79             0x2AB70001B1;
  80           };
  81           [] { // Traps
  82           } // end Traps
  83           [] { // Attributes
  84             Attr(#10) { // LineNumberTable
  85               [] { // LineNumberTable
  86                 0  1;
  87               }
  88             } // end LineNumberTable
  89           } // Attributes
  90         } // end Code
  91       } // Attributes
  92     } // Member
  93   } // methods
  94 
  95   [] { // Attributes
  96     Attr(#11) { // SourceFile
  97       #12;
  98     } // end SourceFile
  99     ;
 100     Attr(#13) { // NestMembers
 101       0x00010004;
 102     } // end NestMembers
 103     ;
 104     Attr(#13) { // NestMembers
 105       0x00010004;
 106     } // end NestMembers
 107     ;
 108     Attr(#6) { // InnerClasses
 109       [] { // InnerClasses
 110         #4 #2 #5 9;
 111       }
 112     } // end InnerClasses
 113   } // Attributes
 114 } // end class NestmateAttributeHolder