|
1 /* |
|
2 * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 package nsk.jdwp.Method.VariableTableWithGeneric; |
|
25 |
|
26 import nsk.share.*; |
|
27 import nsk.share.jpda.*; |
|
28 import nsk.share.jdwp.*; |
|
29 |
|
30 import java.io.*; |
|
31 import java.util.*; |
|
32 |
|
33 /** |
|
34 * This class represents debuggee part in the test. |
|
35 */ |
|
36 public class vartblwithgen001a { |
|
37 |
|
38 public static void main(String args[]) { |
|
39 vartblwithgen001a _vartblwithgen001a = new vartblwithgen001a(); |
|
40 System.exit(vartblwithgen001.JCK_STATUS_BASE + _vartblwithgen001a.runIt(args, System.err)); |
|
41 } |
|
42 |
|
43 public int runIt(String args[], PrintStream out) { |
|
44 //make log for debugee messages |
|
45 ArgumentHandler argumentHandler = new ArgumentHandler(args); |
|
46 Log log = new Log(out, argumentHandler); |
|
47 |
|
48 // make communication pipe to debugger |
|
49 log.display("Creating pipe"); |
|
50 IOPipe pipe = argumentHandler.createDebugeeIOPipe(log); |
|
51 |
|
52 // ensure tested class loaded |
|
53 log.display("Creating object of tested class"); |
|
54 TestedClass<String, Long> foo = new TestedClass<String, Long>(); |
|
55 |
|
56 // send debugger signal READY |
|
57 log.display("Sending signal to debugger: " + vartblwithgen001.READY); |
|
58 pipe.println(vartblwithgen001.READY); |
|
59 |
|
60 // wait for signal QUIT from debugeer |
|
61 log.display("Waiting for signal from debugger: " + vartblwithgen001.QUIT); |
|
62 String signal = pipe.readln(); |
|
63 log.display("Received signal from debugger: " + signal); |
|
64 |
|
65 // check received signal |
|
66 if (! signal.equals(vartblwithgen001.QUIT)) { |
|
67 log.complain("Unexpected communication signal from debugee: " + signal |
|
68 + " (expected: " + vartblwithgen001.QUIT + ")"); |
|
69 log.display("Debugee FAILED"); |
|
70 return vartblwithgen001.FAILED; |
|
71 } |
|
72 |
|
73 // exit debugee |
|
74 log.display("Debugee PASSED"); |
|
75 return vartblwithgen001.PASSED; |
|
76 } |
|
77 |
|
78 // tested class |
|
79 public static class TestedClass<T, N extends Number> { |
|
80 int foo = 0; |
|
81 |
|
82 // tested method |
|
83 public void testedMethod( |
|
84 // not generic argumments |
|
85 boolean arg11PrimBoolean, |
|
86 int arg12PrimInt, |
|
87 Object arg13Object, |
|
88 String arg14String, |
|
89 short[] arg15PrimArrShort, |
|
90 Object[] arg16ObjArrObject, |
|
91 |
|
92 // generic arguments |
|
93 T arg21GenObject, |
|
94 N arg22GenNumber, |
|
95 T[] arg23GenObjectArr, |
|
96 N[] arg24GenNumberArr, |
|
97 List<T> arg25GenObjectList, |
|
98 List<N> arg26GenNumberList, |
|
99 List<? extends T> arg27GenObjectDerivedList, |
|
100 List<? extends N> arg28GenNumberDerivedList |
|
101 ) { |
|
102 |
|
103 // not generic variables |
|
104 boolean var11PrimBoolean = arg11PrimBoolean; |
|
105 int var12PrimInt = arg12PrimInt; |
|
106 Object var13Object = arg13Object; |
|
107 String var14String = arg14String; |
|
108 short[] var15PrimArrShort = arg15PrimArrShort; |
|
109 Object[] var16ObjArrObject = arg16ObjArrObject; |
|
110 |
|
111 // generic variables |
|
112 T var21GenObject = arg21GenObject; |
|
113 N var22GenNumber = arg22GenNumber; |
|
114 T[] var23GenObjectArr = arg23GenObjectArr; |
|
115 N[] var24GenNumberArr = arg24GenNumberArr; |
|
116 List<T> var25GenObjectList = arg25GenObjectList; |
|
117 List<N> var26GenNumberList = arg26GenNumberList; |
|
118 List<? extends T> var27GenObjectDerivedList = arg27GenObjectDerivedList; |
|
119 List<? extends N> var28GenNumberDerivedList = arg28GenNumberDerivedList; |
|
120 } |
|
121 } |
|
122 } |