Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPrivate/isPrivate001a.java
41161 views
/*1* Copyright (c) 2000, 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.Accessible.isPrivate;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debugee application for the isPrivate001 JDI test.32*/3334public class isPrivate001a {3536static boolean verbose_mode = false;3738boolean z0, z1[]={z0}, z2[][]={z1};39byte b0, b1[]={b0}, b2[][]={b1};40char c0, c1[]={c0}, c2[][]={c1};41double d0, d1[]={d0}, d2[][]={d1};42float f0, f1[]={f0}, f2[][]={f1};43int i0, i1[]={i0}, i2[][]={i1};44long l0, l1[]={l0}, l2[][]={l1};4546// Classes must be loaded and linked, so all fields must be47// initialized48Boolean Z0 = Boolean.valueOf(true), Z1[]={Z0}, Z2[][]={Z1};49Byte B0 = Byte.valueOf((byte)1), B1[]={B0}, B2[][]={B1};50Character C0 = Character.valueOf('\u00ff'), C1[]={C0}, C2[][]={C1};51Double D0 = Double.valueOf(1.0), D1[]={D0}, D2[][]={D1};52Float F0 = Float.valueOf(1.0f), F1[]={F0}, F2[][]={F1};53Integer I0 = Integer.valueOf(-1), I1[]={I0}, I2[][]={I1};54Long L0 = Long.valueOf(-1l), L1[]={L0}, L2[][]={L1};55String S0 = new String("4434819"), S1[]={S0}, S2[][]={S1};56Object O0 = new Object(), O1[]={O0}, O2[][]={O1};5758private static class U {}59protected static class V {}60public static class W {}61static class P {} // package private6263U u0=new U(), u1[]={u0}, u2[][]={u1};64V v0=new V(), v1[]={v0}, v2[][]={v1};65W w0=new W(), w1[]={w0}, w2[][]={w1};66P p0=new P(), p1[]={p0}, p2[][]={p1};6768// Interfaces must be loaded and linked, so classes that implement69// interfaces must be initialized.70private static interface s_interf {}71private static class s_interf_impl implements s_interf {}72s_interf_impl sii0 = new s_interf_impl();73s_interf s_interf_0, s_interf_1[]={s_interf_0}, s_interf_2[][]={s_interf_1};7475isPrivate001 a001_0 = new isPrivate001(), a001_1[]={a001_0},76a001_2[][]={a001_1};7778// Class isPrivate001a is initialized in method main()79isPrivate001a a0, a1[]={a0}, a2[][]={a1};80pack_priv_cls ppc0=new pack_priv_cls(), ppc1[]={ppc0}, ppc2[][]={ppc1};81pack_priv_interf_impl ppii0 = new pack_priv_interf_impl();82pack_priv_interf ppi0, ppi1[]={ppi0}, ppi2[][]={ppi1};8384private static void print_log_on_verbose(String message) {85if ( verbose_mode ) {86System.err.println(message);87}88}8990public static void main (String argv[]) {9192for (int i=0; i<argv.length; i++) {93if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {94verbose_mode = true;95break;96}97}9899print_log_on_verbose("**> isPrivate001a: debugee started!");100isPrivate001a isPrivate001a_obj = new isPrivate001a();101ArgumentHandler argHandler = new ArgumentHandler(argv);102IOPipe pipe = argHandler.createDebugeeIOPipe();103print_log_on_verbose("**> isPrivate001a: waiting for \"quit\" signal...");104pipe.println("ready");105String instruction = pipe.readln();106if (instruction.equals("quit")) {107print_log_on_verbose("**> isPrivate001a: \"quit\" signal recieved!");108print_log_on_verbose("**> isPrivate001a: completed succesfully!");109System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/);110}111System.err.println("!!**> isPrivate001a: unexpected signal (no \"quit\") - " + instruction);112System.err.println("!!**> isPrivate001a: FAILED!");113System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/);114}115}116117/** Sample package-private class. */118class pack_priv_cls {}119120/** Sample package-private interface. */121interface pack_priv_interf {}122123/** Class that implements package-private interface */124class pack_priv_interf_impl implements pack_priv_interf {}125126127