Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/signature/signature001a.java
41161 views
/*1* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.jdi.LocalVariable.signature;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debuggee application for the signature001 JDI test.32*/3334public class signature001a {3536//----------------------------------------------------- templete section3738static final int PASSED = 0;39static final int FAILED = 2;40static final int PASS_BASE = 95;4142//-------------------------------------------------- log procedures4344static boolean verbMode = false;4546private static void log1(String message) {47if (verbMode)48System.err.println("**> signature001a: " + message);49}5051private static void logErr(String message) {52if (verbMode)53System.err.println("!!**> signature001a: " + message);54}5556//====================================================== test program5758static TestClass obj = new TestClass();5960//---------------------------------------------------- main method6162public static void main (String argv[]) {6364for (int i=0; i<argv.length; i++) {65if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {66verbMode = true;67break;68}69}70log1("debuggee started!");7172// informing a debugger of readyness73ArgumentHandler argHandler = new ArgumentHandler(argv);74IOPipe pipe = argHandler.createDebugeeIOPipe();75pipe.println("ready");767778int exitCode = PASSED;79for (int i = 0; ; i++) {8081String instruction;8283log1("waiting for an instruction from the debugger ...");84instruction = pipe.readln();85if (instruction.equals("quit")) {86log1("'quit' recieved");87break ;8889} else if (instruction.equals("newcheck")) {90switch (i) {9192//------------------------------------------------------ section tested9394case 0:95pipe.println("checkready");96break ;9798//------------------------------------------------- standard end section99100default:101pipe.println("checkend");102break ;103}104105} else {106logErr("ERRROR: unexpected instruction: " + instruction);107exitCode = FAILED;108break ;109}110}111112System.exit(exitCode + PASS_BASE);113}114}115116class TestClass {117118public void testmethod (int param) {119120boolean bl1 = false, bl2 = true;121byte bt1 = 0, bt2 = 1;122char ch1 = 0, ch2 = 1;123double db1 = 0.0d, db2 = 1.0d;124float fl1 = 0.0f, fl2 = 1.0f;125int in1 = 0, in2 = 1;126long ln1 = 0, ln2 = 1;127short sh1 = 0, sh2 = 1;128129ClassForCheck_2 class2 = new ClassForCheck_2();130InterfaceForCheck iface = class2;131ClassForCheck cfc[] = { new ClassForCheck(), new ClassForCheck() };132133return;134}135/*136public ClassForCheck[] arraymethod () {137return cfc;138}139public ClassForCheck classmethod () {140return classFC;141}142public InterfaceForCheck ifacemethod () {143return iface;144}145*/146}147148149interface InterfaceForCheck {150151// static final boolean s_iface_boolean = true;152static final byte s_iface_byte = (byte)1;153static final char s_iface_char = '1';154static final double s_iface_double = 999;155static final float s_iface_float = 99;156static final int s_iface_int = 100;157static final long s_iface_long = 1000;158static final Object s_iface_object = new Object();159}160161class ClassForCheck_2 implements InterfaceForCheck {162}163164class ClassForCheck {165166// static fields167168static boolean bl[] = {true, false};169170static boolean s_boolean;171static byte s_byte;172static char s_char;173static double s_double;174static float s_float;175static int s_int;176static long s_long;177178// instance fields179180boolean i_boolean;181byte i_byte;182char i_char;183double i_double;184float i_float;185int i_int;186long i_long;187}188189190