1 /*
  2  * Copyright (c) 2022, 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   63; // 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 "Preload"; // #31
 73     class #33; // #32
 74     Utf8 "PreloadValue1"; // #33
 75   } // Constant Pool
 76 
 77   0x0021; // access
 78   #21;// this_cpx
 79   #2;// super_cpx
 80 
 81   [] { // Interfaces
 82   } // Interfaces
 83 
 84   [] { // Fields
 85     {  // field
 86       0x0000; // access
 87       #23; // name_index
 88       #24; // descriptor_index
 89       [] { // Attributes
 90       } // Attributes
 91     }
 92   } // Fields
 93 
 94   [] { // Methods
 95     {  // method
 96       0x0001; // access
 97       #5; // name_index
 98       #6; // descriptor_index
 99       [] { // Attributes
100         Attr(#25) { // Code
101           1; // max_stack
102           1; // max_locals
103           Bytes[]{
104             0x2AB70001B1;
105           }
106           [] { // Traps
107           } // end Traps
108           [] { // Attributes
109             Attr(#26) { // LineNumberTable
110               [] { // line_number_table
111                 0  1;
112               }
113             } // end LineNumberTable
114           } // Attributes
115         } // end Code
116       } // Attributes
117     }
118     ;
119     {  // method
120       0x0009; // access
121       #27; // name_index
122       #28; // descriptor_index
123       [] { // Attributes
124         Attr(#25) { // Code
125           2; // max_stack
126           1; // max_locals
127           Bytes[]{
128             0xB20007120DB6000F;
129             0xB1;
130           }
131           [] { // Traps
132           } // end Traps
133           [] { // Attributes
134             Attr(#26) { // LineNumberTable
135               [] { // line_number_table
136                 0  5;
137                 8  6;
138               }
139             } // end LineNumberTable
140           } // Attributes
141         } // end Code
142       } // Attributes
143     }
144   } // Methods
145 
146   [] { // Attributes
147     Attr(#29) { // SourceFile
148       #30;
149     } // end SourceFile
150     ;
151     Attr(#31) { // Preload
152       0x00010020;
153     } // end Preload
154   } // Attributes
155 } // end class ValuePreloadClient1