Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/toString/tostring001a.java
41161 views
/*1* Copyright (c) 2002, 2021, 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.ClassObjectReference.toString;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;2829// THIS TEST IS LINE NUMBER SENSITIVE3031/**32* The debugged applcation of the test.33*/34public class tostring001a {3536//------------------------------------------------------- immutable common fields3738private static int exitStatus;39private static ArgumentHandler argHandler;40private static Log log;41private static IOPipe pipe;4243//------------------------------------------------------- immutable common methods4445static void display(String msg) {46log.display("debuggee > " + msg);47}4849static void complain(String msg) {50log.complain("debuggee FAILURE > " + msg);51}5253public static void receiveSignal(String signal) {54String line = pipe.readln();5556if ( !line.equals(signal) )57throw new Failure("UNEXPECTED debugger's signal " + line);5859display("debuger's <" + signal + "> signal received.");60}6162//------------------------------------------------------ mutable common fields6364//------------------------------------------------------ test specific fields6566public final static String brkpMethodName = "main";67public final static int brkpLineNumber = 121;6869// Classes must be loaded and linked, so all fields must be70// initialized71Boolean Z0 = Boolean.valueOf(true), Z1[]={Z0}, Z2[][]={Z1};72Byte B0 = Byte.valueOf((byte)1), B1[]={B0}, B2[][]={B1};73Character C0 = Character.valueOf('\u00ff'), C1[]={C0}, C2[][]={C1};74Double D0 = Double.valueOf(1.0), D1[]={D0}, D2[][]={D1};75Float F0 = Float.valueOf(1.0f), F1[]={F0}, F2[][]={F1};76Integer I0 = Integer.valueOf(-1), I1[]={I0}, I2[][]={I1};77Long L0 = Long.valueOf(-1l), L1[]={L0}, L2[][]={L1};78Short H0 = Short.valueOf((short)-1), H1[]={H0}, H2[][]={H1};79String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1};80Object O0 = new Object(), O1[]={O0}, O2[][]={O1};8182// Interfaces must be loaded and linked, so classes that implement83// interfaces must be initialized.84static class innerClass {}85static interface innerInterf {}86protected static class innerInterfImpl implements innerInterf {}87innerInterfImpl sii0 = new innerInterfImpl();8889innerClass innerClass0 = new innerClass();90innerClass innerClass1[] = {innerClass0};91innerClass innerClass2[][] = {innerClass1};9293innerInterf innerInterf0;94innerInterf innerInterf1[] = {innerInterf0};95innerInterf innerInterf2[][] = {innerInterf1};9697tostring001aClass tostring001aClass0 = new tostring001aClass();98tostring001aClass tostring001aClass1[] = {tostring001aClass0};99tostring001aClass tostring001aClass2[][] = {tostring001aClass1};100101class tostring001aInterfImpl implements tostring001aInterf {}102tostring001aInterfImpl pii0 = new tostring001aInterfImpl();103tostring001aInterf tostring001aInterf0;104tostring001aInterf tostring001aInterf1[] = {tostring001aInterf0};105tostring001aInterf tostring001aInterf2[][] = {tostring001aInterf1};106107//------------------------------------------------------ mutable common method108109public static void main (String argv[]) {110exitStatus = Consts.TEST_FAILED;111argHandler = new ArgumentHandler(argv);112log = new Log(System.err, argHandler);113pipe = argHandler.createDebugeeIOPipe(log);114115tostring001a dummy = new tostring001a();116117try {118pipe.println(tostring001.SIGNAL_READY);119receiveSignal(tostring001.SIGNAL_GO);120log.display("breakpoint line"); // brkpLineNumber121receiveSignal(tostring001.SIGNAL_QUIT);122display("completed succesfully.");123System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);124} catch (Failure e) {125log.complain(e.getMessage());126System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE);127}128}129130//--------------------------------------------------------- test specific methods131}132133//--------------------------------------------------------- test specific classes134class tostring001aClass {}135interface tostring001aInterf {}136137138