Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/ByteValue/hashCode/hashcode001a.java
41161 views
/*1* Copyright (c) 2000, 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.ByteValue.hashCode;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debugee application for the hashcode001a JDI test.32*/3334public class hashcode001a {3536//----------------------------------------------------- templete section3738static final int PASSED = 0;39static final int FAILED = 2;40static final int PASS_BASE = 95;4142//-------------------------------------------------- log procedures4344static boolean verbMode = false; // debugger may switch to true4546private static void log1(String message) {47if (verbMode)48System.err.println("**> hashcode001a: " + message);49}5051private static void logErr(String message) {52if (verbMode)53System.err.println("!!**> hashcode001a: " + message);54}5556//====================================================== test program57//................................................... globals for a debugger5859// public static byte smallest = Byte.MIN_VALUE;60// public static byte zero = 0;61// public static byte largest = Byte.MAX_VALUE;6263public static byte plus1_1 = +1;64public static byte plus1_2 = +1;65// public static byte minus1 = -1;6667// public static short shortplus1 = +1;6869//....................................................70//---------------------------------------------------- main method7172public static void main (String argv[]) {7374for (int i=0; i<argv.length; i++) {75if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {76verbMode = true;77break;78}79}80log1("debugee started!");8182// informing debuger of readyness83ArgumentHandler argHandler = new ArgumentHandler(argv);84IOPipe pipe = argHandler.createDebugeeIOPipe();85pipe.println("ready");8687int exitCode = PASSED;88for (int i = 0; ; i++) {8990String instruction;9192log1("waiting for an instruction from the debuger ...");93instruction = pipe.readln();94if (instruction.equals("quit")) {95log1("'quit' recieved");96break ;9798} else if (instruction.equals("newcheck")) {99switch (i) {100101//------------------------------------------------------ section tested102103case 0:104pipe.println("checkready");105break ;106107//------------------------------------------------- standard end section108109default:110pipe.println("checkend");111break ;112}113114} else {115logErr("ERRROR: unexpected instruction: " + instruction);116exitCode = 2;117break ;118}119}120121System.exit(exitCode + PASS_BASE);122}123}124125126