1 /* 2 * Copyright (c) 2000, 2018, 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 package nsk.jdi.ClassObjectReference.reflectedType; 25 26 import nsk.share.*; 27 import nsk.share.jpda.*; 28 import nsk.share.jdi.*; 29 30 31 /** 32 * This class is used as debugee application for the reflectype001 JDI test. 33 */ 34 35 public class reflectype001a { 36 37 static boolean verbose_mode = false; // debugger may switch to true 38 // - for more easy failure evaluation 39 40 boolean z0, z1[]={z0}, z2[][]={z1}; 41 byte b0, b1[]={b0}, b2[][]={b1}; 42 char c0, c1[]={c0}, c2[][]={c1}; 43 double d0, d1[]={d0}, d2[][]={d1}; 44 float f0, f1[]={f0}, f2[][]={f1}; 45 int i0, i1[]={i0}, i2[][]={i1}; 46 long l0, l1[]={l0}, l2[][]={l1}; 47 48 // Classes must be loaded and linked, so all fields must be 49 // initialized 50 Boolean Z0 = new Boolean(true), Z1[]={Z0}, Z2[][]={Z1}; 51 Byte B0 = new Byte((byte)1), B1[]={B0}, B2[][]={B1}; 52 Character C0 = new Character('\u00ff'), C1[]={C0}, C2[][]={C1}; 53 Double D0 = new Double(1.0), D1[]={D0}, D2[][]={D1}; 54 Float F0 = new Float(1.0f), F1[]={F0}, F2[][]={F1}; 55 Integer I0 = new Integer(-1), I1[]={I0}, I2[][]={I1}; 56 Long L0 = new Long(-1l), L1[]={L0}, L2[][]={L1}; 57 String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1}; 58 Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; 59 60 // Interfaces must be loaded and linked, so classes that implement 61 // interfaces must be initialized. 62 static class s_class {} 63 static interface s_interf {} 64 protected static class s_interf_impl implements s_interf {} 65 s_interf_impl sii0 = new s_interf_impl(); 66 67 s_class s_class0 = new s_class(), s_class1[]={s_class0}, 68 s_class2[][]={s_class1}; 69 s_interf s_interf0, s_interf1[]={s_interf0}, s_interf2[][]={s_interf1}; 70 71 package_class package_class0 = new package_class(), 72 package_class1[]={package_class0}, 73 package_class2[][]={package_class1}; 74 class package_interf_impl implements package_interf {} 75 package_interf_impl pii0 = new package_interf_impl(); 76 package_interf package_interf0, package_interf1[]={package_interf0}, 77 package_interf2[][]={package_interf1}; print_log_on_verbose(String message)78 private static void print_log_on_verbose(String message) { 79 if ( verbose_mode ) { 80 System.err.println(message); 81 } 82 } 83 main(String argv[])84 public static void main (String argv[]) { 85 86 for (int i=0; i<argv.length; i++) { 87 if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) { 88 verbose_mode = true; 89 break; 90 } 91 } 92 93 print_log_on_verbose("**> reflectype001a: debugee started!"); 94 ArgumentHandler argHandler = new ArgumentHandler(argv); 95 IOPipe pipe = argHandler.createDebugeeIOPipe(); 96 97 reflectype001a reflectype001a_obj = new reflectype001a(); 98 99 print_log_on_verbose("**> reflectype001a: waiting for \"quit\" signal..."); 100 pipe.println("ready"); 101 String instruction = pipe.readln(); 102 if (instruction.equals("quit")) { 103 print_log_on_verbose("**> reflectype001a: \"quit\" signal recieved!"); 104 print_log_on_verbose("**> reflectype001a: completed succesfully!"); 105 System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); 106 } 107 System.err.println("!!**> reflectype001a: unexpected signal (no \"quit\") - " + instruction); 108 System.err.println("!!**> reflectype001a: FAILED!"); 109 System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); 110 } 111 } 112 113 /** simple class */ 114 class package_class {} 115 116 /** simple interface */ 117 interface package_interf {} 118