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.ReferenceType.name; 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 name001 JDI test. 33 */ 34 35 public class name001a { 36 37 static boolean verbose_mode = false; // debugger may switch to true 38 // - for more easy failure evaluation 39 40 41 boolean z0, z1[]={z0}, z2[][]={z1}; 42 byte b0, b1[]={b0}, b2[][]={b1}; 43 char c0, c1[]={c0}, c2[][]={c1}; 44 double d0, d1[]={d0}, d2[][]={d1}; 45 float f0, f1[]={f0}, f2[][]={f1}; 46 int i0, i1[]={i0}, i2[][]={i1}; 47 long l0, l1[]={l0}, l2[][]={l1}; 48 49 // Classes must be loaded and linked, so all fields must be 50 // initialized 51 Boolean Z0 = new Boolean(true), Z1[]={Z0}, Z2[][]={Z1}; 52 Byte B0 = new Byte((byte)1), B1[]={B0}, B2[][]={B1}; 53 Character C0 = new Character('\u00ff'), C1[]={C0}, C2[][]={C1}; 54 Double D0 = new Double(1.0), D1[]={D0}, D2[][]={D1}; 55 Float F0 = new Float(1.0f), F1[]={F0}, F2[][]={F1}; 56 Integer I0 = new Integer(-1), I1[]={I0}, I2[][]={I1}; 57 Long L0 = new Long(-1l), L1[]={L0}, L2[][]={L1}; 58 String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1}; 59 Object O0 = new Object(), O1[]={O0}, O2[][]={O1}; 60 61 static class s_class {} 62 s_class s_class_0 = new s_class(), s_class_1[]={s_class_0}, 63 s_class_2[][]={s_class_1}; 64 65 // Interfaces must be loaded and linked, so classes that implement 66 // interfaces must be initialized. 67 static interface s_interf {} 68 static class s_interf_impl implements s_interf {} 69 s_interf_impl sii0 = new s_interf_impl(); 70 s_interf s_interf_0, s_interf_1[]={s_interf_0}, s_interf_2[][]={s_interf_1}; 71 72 ClassForCheck class_for_check0 = new ClassForCheck(), 73 class_for_check1[]={class_for_check0}, 74 class_for_check2[][]={class_for_check1}; 75 InterfaceForCheck_impl interf_for_check_impl0 = new InterfaceForCheck_impl(); 76 InterfaceForCheck interf_for_check0, 77 interf_for_check1[]={interf_for_check0}, 78 interf_for_check2[][]={interf_for_check1}; 79 print_log_on_verbose(String message)80 private static void print_log_on_verbose(String message) { 81 if ( verbose_mode ) { 82 System.err.println(message); 83 } 84 } 85 main(String argv[])86 public static void main (String argv[]) { 87 88 for (int i=0; i<argv.length; i++) { 89 if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) { 90 verbose_mode = true; 91 break; 92 } 93 } 94 95 print_log_on_verbose("**> name001a: debugee started!"); 96 ArgumentHandler argHandler = new ArgumentHandler(argv); 97 IOPipe pipe = argHandler.createDebugeeIOPipe(); 98 99 name001a name001a_obj = new name001a(); 100 101 print_log_on_verbose("**> name001a: waiting for \"quit\" signal..."); 102 pipe.println("ready"); 103 String instruction = pipe.readln(); 104 if (instruction.equals("quit")) { 105 print_log_on_verbose("**> name001a: \"quit\" signal recieved!"); 106 print_log_on_verbose("**> name001a: completed succesfully!"); 107 System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/); 108 } 109 System.err.println("!!**> name001a: unexpected signal (no \"quit\") - " + instruction); 110 System.err.println("!!**> name001a: FAILED!"); 111 System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/); 112 } 113 } 114 115 class ClassForCheck {} 116 117 interface InterfaceForCheck {} 118 119 class InterfaceForCheck_impl implements InterfaceForCheck{} 120