1 /*
  2  * Copyright (c) 2025, 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 class OuterTest1 {
 27     class Inner {
 28         public void foo() { System.out.println("Inner.foo"); }
 29     };
 30 }
 31 
 32 Nested class acccess flags are made invalid in this jcod file.
 33 */
 34 
 35 class OuterTest1 {
 36   0xCAFEBABE;
 37   0; // minor version
 38   71; // version
 39   [] { // Constant Pool
 40     ; // first element is empty
 41     Method #2 #3; // #1
 42     class #4; // #2
 43     NameAndType #5 #6; // #3
 44     Utf8 "java/lang/Object"; // #4
 45     Utf8 "<init>"; // #5
 46     Utf8 "()V"; // #6
 47     class #8; // #7
 48     Utf8 "OuterTest1"; // #8
 49     Utf8 "Code"; // #9
 50     Utf8 "LineNumberTable"; // #10
 51     Utf8 "SourceFile"; // #11
 52     Utf8 "OuterTest1.java"; // #12
 53     Utf8 "NestMembers"; // #13
 54     class #15; // #14
 55     Utf8 "OuterTest1$Inner"; // #15
 56     Utf8 "InnerClasses"; // #16
 57     Utf8 "Inner"; // #17
 58   } // Constant Pool
 59 
 60   0x0020; // access
 61   #7;// this_cpx
 62   #2;// super_cpx
 63 
 64   [] { // Interfaces
 65   } // Interfaces
 66 
 67   [] { // Fields
 68   } // Fields
 69 
 70   [] { // Methods
 71     {  // method
 72       0x0000; // access
 73       #5; // name_index
 74       #6; // descriptor_index
 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               [] { // line_number_table
 87                 0  3;
 88               }
 89             } // end LineNumberTable
 90           } // Attributes
 91         } // end Code
 92       } // Attributes
 93     }
 94   } // Methods
 95 
 96   [] { // Attributes
 97     Attr(#11) { // SourceFile
 98       #12;
 99     } // end SourceFile
100     ;
101     Attr(#13) { // NestMembers
102       [] { // classes
103         #14;
104       }
105     } // end NestMembers
106     ;
107     Attr(#16) { // InnerClasses
108       [] { // classes
109         #14 #7 #17 0x0fff;   // This access flag sets is_interface & is_final, so invalid.
110       }
111     } // end InnerClasses
112   } // Attributes
113 } // end class OuterTest1