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 
  25 // This is a .jcod file for a simple "Hello World" program with ACC_MODULE added
  26 // to its access_flags. (See line 67.)  This should cause a NoClassDefFoundError
  27 // when loading the class.
  28 class badAccModule {
  29   0xCAFEBABE;
  30   0; // minor version
  31   53; // version
  32   [32] { // Constant Pool
  33     ; // first element is empty
  34     Method #6 #17; // #1     at 0x0A
  35     Field #18 #19; // #2     at 0x0F
  36     String #20; // #3     at 0x14
  37     Method #21 #22; // #4     at 0x17
  38     class #23; // #5     at 0x1C
  39     class #24; // #6     at 0x1F
  40     Utf8 "<init>"; // #7     at 0x22
  41     Utf8 "()V"; // #8     at 0x2B
  42     Utf8 "Code"; // #9     at 0x31
  43     Utf8 "LineNumberTable"; // #10     at 0x38
  44     Utf8 "main"; // #11     at 0x4A
  45     Utf8 "([Ljava/lang/String;)V"; // #12     at 0x51
  46     Utf8 "Exceptions"; // #13     at 0x6A
  47     class #25; // #14     at 0x77
  48     Utf8 "SourceFile"; // #15     at 0x7A
  49     Utf8 "badAccModule.java"; // #16     at 0x87
  50     NameAndType #7 #8; // #17     at 0x9B
  51     class #26; // #18     at 0xA0
  52     NameAndType #27 #28; // #19     at 0xA3
  53     Utf8 "Hello World"; // #20     at 0xA8
  54     class #29; // #21     at 0xB6
  55     NameAndType #30 #31; // #22     at 0xB9
  56     Utf8 "badAccModule"; // #23     at 0xBE
  57     Utf8 "java/lang/Object"; // #24     at 0xCD
  58     Utf8 "java/lang/Throwable"; // #25     at 0xE0
  59     Utf8 "java/lang/System"; // #26     at 0xF6
  60     Utf8 "out"; // #27     at 0x0109
  61     Utf8 "Ljava/io/PrintStream;"; // #28     at 0x010F
  62     Utf8 "java/io/PrintStream"; // #29     at 0x0127
  63     Utf8 "println"; // #30     at 0x013D
  64     Utf8 "(Ljava/lang/String;)V"; // #31     at 0x0147
  65   } // Constant Pool
  66 
  67   0x8021; // access  Added ACC_MODULE (0x8000) !!!
  68   #5;// this_cpx
  69   #6;// super_cpx
  70 
  71   [0] { // Interfaces
  72   } // Interfaces
  73 
  74   [0] { // fields
  75   } // fields
  76 
  77   [2] { // methods
  78     { // Member at 0x016B
  79       0x0001; // access
  80       #7; // name_cpx
  81       #8; // sig_cpx
  82       [1] { // Attributes
  83         Attr(#9, 29) { // Code at 0x0173
  84           1; // max_stack
  85           1; // max_locals
  86           Bytes[5]{
  87             0x2AB70001B1;
  88           };
  89           [0] { // Traps
  90           } // end Traps
  91           [1] { // Attributes
  92             Attr(#10, 6) { // LineNumberTable at 0x018A
  93               [1] { // LineNumberTable
  94                 0  1; //  at 0x0196
  95               }
  96             } // end LineNumberTable
  97           } // Attributes
  98         } // end Code
  99       } // Attributes
 100     } // Member
 101     ;
 102     { // Member at 0x0196
 103       0x0009; // access
 104       #11; // name_cpx
 105       #12; // sig_cpx
 106       [2] { // Attributes
 107         Attr(#9, 37) { // Code at 0x019E
 108           2; // max_stack
 109           1; // max_locals
 110           Bytes[9]{
 111             0xB200021203B60004;
 112             0xB1;
 113           };
 114           [0] { // Traps
 115           } // end Traps
 116           [1] { // Attributes
 117             Attr(#10, 10) { // LineNumberTable at 0x01B9
 118               [2] { // LineNumberTable
 119                 0  4; //  at 0x01C5
 120                 8  5; //  at 0x01C9
 121               }
 122             } // end LineNumberTable
 123           } // Attributes
 124         } // end Code
 125         ;
 126         Attr(#13, 4) { // Exceptions at 0x01C9
 127           [1] { // Exceptions
 128             #14; //  at 0x01D3
 129           }
 130         } // end Exceptions
 131       } // Attributes
 132     } // Member
 133   } // methods
 134 
 135   [1] { // Attributes
 136     Attr(#15, 2) { // SourceFile at 0x01D5
 137       #16;
 138     } // end SourceFile
 139   } // Attributes
 140 } // end class badAccModule