Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001a.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.jdwp.Method.VariableTableWithGeneric;2425import nsk.share.*;26import nsk.share.jpda.*;27import nsk.share.jdwp.*;2829import java.io.*;30import java.util.*;3132/**33* This class represents debuggee part in the test.34*/35public class vartblwithgen001a {3637public static void main(String args[]) {38vartblwithgen001a _vartblwithgen001a = new vartblwithgen001a();39System.exit(vartblwithgen001.JCK_STATUS_BASE + _vartblwithgen001a.runIt(args, System.err));40}4142public int runIt(String args[], PrintStream out) {43//make log for debugee messages44ArgumentHandler argumentHandler = new ArgumentHandler(args);45Log log = new Log(out, argumentHandler);4647// make communication pipe to debugger48log.display("Creating pipe");49IOPipe pipe = argumentHandler.createDebugeeIOPipe(log);5051// ensure tested class loaded52log.display("Creating object of tested class");53TestedClass<String, Long> foo = new TestedClass<String, Long>();5455// send debugger signal READY56log.display("Sending signal to debugger: " + vartblwithgen001.READY);57pipe.println(vartblwithgen001.READY);5859// wait for signal QUIT from debugeer60log.display("Waiting for signal from debugger: " + vartblwithgen001.QUIT);61String signal = pipe.readln();62log.display("Received signal from debugger: " + signal);6364// check received signal65if (! signal.equals(vartblwithgen001.QUIT)) {66log.complain("Unexpected communication signal from debugee: " + signal67+ " (expected: " + vartblwithgen001.QUIT + ")");68log.display("Debugee FAILED");69return vartblwithgen001.FAILED;70}7172// exit debugee73log.display("Debugee PASSED");74return vartblwithgen001.PASSED;75}7677// tested class78public static class TestedClass<T, N extends Number> {79int foo = 0;8081// tested method82public void testedMethod(83// not generic argumments84boolean arg11PrimBoolean,85int arg12PrimInt,86Object arg13Object,87String arg14String,88short[] arg15PrimArrShort,89Object[] arg16ObjArrObject,9091// generic arguments92T arg21GenObject,93N arg22GenNumber,94T[] arg23GenObjectArr,95N[] arg24GenNumberArr,96List<T> arg25GenObjectList,97List<N> arg26GenNumberList,98List<? extends T> arg27GenObjectDerivedList,99List<? extends N> arg28GenNumberDerivedList100) {101102// not generic variables103boolean var11PrimBoolean = arg11PrimBoolean;104int var12PrimInt = arg12PrimInt;105Object var13Object = arg13Object;106String var14String = arg14String;107short[] var15PrimArrShort = arg15PrimArrShort;108Object[] var16ObjArrObject = arg16ObjArrObject;109110// generic variables111T var21GenObject = arg21GenObject;112N var22GenNumber = arg22GenNumber;113T[] var23GenObjectArr = arg23GenObjectArr;114N[] var24GenNumberArr = arg24GenNumberArr;115List<T> var25GenObjectList = arg25GenObjectList;116List<N> var26GenNumberList = arg26GenNumberList;117List<? extends T> var27GenObjectDerivedList = arg27GenObjectDerivedList;118List<? extends N> var28GenNumberDerivedList = arg28GenNumberDerivedList;119}120}121}122123124