1 /*
  2  * Copyright (c) 2022, 2024, 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 // The test class is based in the Java source code below, but the constant
 25 // pool entry #33 (used by the Preload attribute) has been modified to
 26 // contain the name of a non-existing class.
 27 //
 28 // public class ValuePreloadClient1 {
 29 //     PreloadValue0 value;
 30 //
 31 //     public static void main(String[] args) {
 32 //         System.out.print("Success");
 33 //     }
 34 // }
 35 
 36  class ValuePreloadClient1 {
 37   0xCAFEBABE;
 38   0; // minor version
 39   68; // version
 40   [] { // Constant Pool
 41     ; // first element is empty
 42     Method #2 #3; // #1
 43     class #4; // #2
 44     NameAndType #5 #6; // #3
 45     Utf8 "java/lang/Object"; // #4
 46     Utf8 "<init>"; // #5
 47     Utf8 "()V"; // #6
 48     Field #8 #9; // #7
 49     class #10; // #8
 50     NameAndType #11 #12; // #9
 51     Utf8 "java/lang/System"; // #10
 52     Utf8 "out"; // #11
 53     Utf8 "Ljava/io/PrintStream;"; // #12
 54     String #14; // #13
 55     Utf8 "Success"; // #14
 56     Method #16 #17; // #15
 57     class #18; // #16
 58     NameAndType #19 #20; // #17
 59     Utf8 "java/io/PrintStream"; // #18
 60     Utf8 "print"; // #19
 61     Utf8 "(Ljava/lang/String;)V"; // #20
 62     class #22; // #21
 63     Utf8 "ValuePreloadClient1"; // #22
 64     Utf8 "value"; // #23
 65     Utf8 "LPreloadValue0;"; // #24
 66     Utf8 "Code"; // #25
 67     Utf8 "LineNumberTable"; // #26
 68     Utf8 "main"; // #27
 69     Utf8 "([Ljava/lang/String;)V"; // #28
 70     Utf8 "SourceFile"; // #29
 71     Utf8 "ValuePreloadClient1.java"; // #30
 72     Utf8 "LoadableDescriptors"; // #31
 73     Utf8 "LPreloadValue1;"; // #32
 74   } // Constant Pool
 75 
 76   0x0021; // access
 77   #21;// this_cpx
 78   #2;// super_cpx
 79 
 80   [] { // Interfaces
 81   } // Interfaces
 82 
 83   [] { // Fields
 84     {  // field
 85       0x0000; // access
 86       #23; // name_index
 87       #24; // descriptor_index
 88       [] { // Attributes
 89       } // Attributes
 90     }
 91   } // Fields
 92 
 93   [] { // Methods
 94     {  // method
 95       0x0001; // access
 96       #5; // name_index
 97       #6; // descriptor_index
 98       [] { // Attributes
 99         Attr(#25) { // Code
100           1; // max_stack
101           1; // max_locals
102           Bytes[]{
103             0x2AB70001B1;
104           }
105           [] { // Traps
106           } // end Traps
107           [] { // Attributes
108             Attr(#26) { // LineNumberTable
109               [] { // line_number_table
110                 0  1;
111               }
112             } // end LineNumberTable
113           } // Attributes
114         } // end Code
115       } // Attributes
116     }
117     ;
118     {  // method
119       0x0009; // access
120       #27; // name_index
121       #28; // descriptor_index
122       [] { // Attributes
123         Attr(#25) { // Code
124           2; // max_stack
125           1; // max_locals
126           Bytes[]{
127             0xB20007120DB6000F;
128             0xB1;
129           }
130           [] { // Traps
131           } // end Traps
132           [] { // Attributes
133             Attr(#26) { // LineNumberTable
134               [] { // line_number_table
135                 0  5;
136                 8  6;
137               }
138             } // end LineNumberTable
139           } // Attributes
140         } // end Code
141       } // Attributes
142     }
143   } // Methods
144 
145   [] { // Attributes
146     Attr(#29) { // SourceFile
147       #30;
148     } // end SourceFile
149     ;
150     Attr(#31) { // LoadableDescriptors
151       0x00010020;
152     } // end LoadableDescriptors
153   } // Attributes
154 } // end class ValuePreloadClient1