Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Accessible/isPublic/isPublic001a.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.isPublic;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;282930/**31* This class is used as debugee application for the isPublic001 JDI test.32*/3334public class isPublic001a {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.70public static interface s_interf {}71protected 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};7475isPublic001 a001_0=new isPublic001(), a001_1[]={a001_0}, a001_2[][]={a001_1};7677// Class isPrivate001a is initialized in method main()78isPublic001a a0, a1[]={a0}, a2[][]={a1};79pack_priv_cls ppc0=new pack_priv_cls(), ppc1[]={ppc0}, ppc2[][]={ppc1};80pack_priv_interf_impl ppii0 = new pack_priv_interf_impl();81pack_priv_interf ppi0, ppi1[]={ppi0}, ppi2[][]={ppi1};8283private static void print_log_on_verbose(String message) {84if ( verbose_mode ) {85System.err.println(message);86}87}8889public static void main (String argv[]) {9091for (int i=0; i<argv.length; i++) {92if ( argv[i].equals("-vbs") || argv[i].equals("-verbose") ) {93verbose_mode = true;94break;95}96}9798print_log_on_verbose("**> isPublic001a: debugee started!");99isPublic001a isPublic001a_obj = new isPublic001a();100ArgumentHandler argHandler = new ArgumentHandler(argv);101IOPipe pipe = argHandler.createDebugeeIOPipe();102print_log_on_verbose("**> isPublic001a: waiting for \"quit\" signal...");103pipe.println("ready");104String instruction = pipe.readln();105if (instruction.equals("quit")) {106print_log_on_verbose("**> isPublic001a: \"quit\" signal recieved!");107print_log_on_verbose("**> isPublic001a: completed succesfully!");108System.exit(0/*STATUS_PASSED*/ + 95/*STATUS_TEMP*/);109}110System.err.println("!!**> isPublic001a: unexpected signal (no \"quit\") - " + instruction);111System.err.println("!!**> isPublic001a: FAILED!");112System.exit(2/*STATUS_FAILED*/ + 95/*STATUS_TEMP*/);113}114}115116/** Sample package-private class. */117class pack_priv_cls {}118119/** Sample package-private interface. */120interface pack_priv_interf {}121122/** Class that implements package-private interface */123class pack_priv_interf_impl implements pack_priv_interf {}124125126