Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/LocalVariable/genericSignature/gensignature001a.java
41161 views
/*1* Copyright (c) 2004, 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.genericSignature;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdi.*;2829import java.util.*;30import java.io.*;3132/**33* This class is used as debugee part of the test.34*/3536public class gensignature001a {3738private static ArgumentHandler argsHandler;39private static Log log;40private static IOPipe pipe;4142//------------------------------------------------------- immutable common methods4344static void display(String msg) {45log.display("debuggee > " + msg);46}4748static void complain(String msg) {49log.complain("debuggee FAILURE > " + msg);50}5152public static void receiveSignal(String signal) {53String line = pipe.readln();5455if ( !line.equals(signal) )56throw new Failure("UNEXPECTED debugger's signal " + line);5758display("debugger's <" + signal + "> signal received.");59}6061//------------------------------------------------------ mutable common fields6263public static void main(String args[]) {64gensignature001a _gensignature001a = new gensignature001a();65System.exit(Consts.JCK_STATUS_BASE + _gensignature001a.runThis(args, System.err));66}6768public int runThis(String args[], PrintStream out) {6970argsHandler = new ArgumentHandler(args);71log = new Log(out, argsHandler);72pipe = argsHandler.createDebugeeIOPipe(log);7374display("Debugee started!");7576// ensure tested class loaded77display("Creating object of tested class");78TestedClass<String, Long> foo = new TestedClass<String, Long>();7980// send debugger signal READY81display("Sending signal to debugger: " + gensignature001.READY);82pipe.println(gensignature001.READY);8384// wait for signal QUIT from debugeer85display("Wait for '" + gensignature001.QUIT + "' signal from debugger...");86receiveSignal(gensignature001.QUIT);8788display("Debugee PASSED");89return Consts.TEST_PASSED;90}9192// tested class93public static class TestedClass<T, N extends Number> {94int foo = 0;9596// tested method97public void testedMethod(98// not generic argumments99boolean arg11PrimBoolean,100int arg12PrimInt,101Object arg13Object,102String arg14String,103short[] arg15PrimArrShort,104Object[] arg16ObjArrObject,105106// generic arguments107T arg21GenObject,108N arg22GenNumber,109T[] arg23GenObjectArr,110N[] arg24GenNumberArr,111List<T> arg25GenObjectList,112List<N> arg26GenNumberList,113List<? extends T> arg27GenObjectDerivedList,114List<? extends N> arg28GenNumberDerivedList115) {116117// not generic variables118boolean var11PrimBoolean = arg11PrimBoolean;119int var12PrimInt = arg12PrimInt;120Object var13Object = arg13Object;121String var14String = arg14String;122short[] var15PrimArrShort = arg15PrimArrShort;123Object[] var16ObjArrObject = arg16ObjArrObject;124125// generic variables126T var21GenObject = arg21GenObject;127N var22GenNumber = arg22GenNumber;128T[] var23GenObjectArr = arg23GenObjectArr;129N[] var24GenNumberArr = arg24GenNumberArr;130List<T> var25GenObjectList = arg25GenObjectList;131List<N> var26GenNumberList = arg26GenNumberList;132List<? extends T> var27GenObjectDerivedList = arg27GenObjectDerivedList;133List<? extends N> var28GenNumberDerivedList = arg28GenNumberDerivedList;134}135}136} // end of gensignature001a class137138139