Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002a.java
41162 views
1
/*
2
* Copyright (c) 2001, 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.ArrayReference.GetValues;
25
26
import nsk.share.*;
27
import nsk.share.jpda.*;
28
import nsk.share.jdwp.*;
29
30
import java.io.*;
31
32
public class getvalues002a {
33
34
public static final String ARRAY_FIELD_NAME = "array";
35
public static final int FIELDS_COUNT = 10;
36
public static final int ARRAY_FIRST_INDEX = 4;
37
public static final int ARRAY_LENGTH = ARRAY_FIRST_INDEX + FIELDS_COUNT + 5;
38
39
public static void main(String args[]) {
40
getvalues002a _getvalues002a = new getvalues002a();
41
System.exit(getvalues002.JCK_STATUS_BASE + _getvalues002a.runIt(args, System.err));
42
}
43
44
public int runIt(String args[], PrintStream out) {
45
//make log for debugee messages
46
ArgumentHandler argumentHandler = new ArgumentHandler(args);
47
Log log = new Log(out, argumentHandler);
48
49
// meke communication pipe to debugger
50
log.display("Creating pipe");
51
IOPipe pipe = argumentHandler.createDebugeeIOPipe(log);
52
53
// ensure tested class loaded
54
log.display("Creating and fille tested array");
55
TestedClass.setArrayValues();
56
57
// send debugger signal READY
58
log.display("Sending signal to debugger: " + getvalues002.READY);
59
pipe.println(getvalues002.READY);
60
61
// wait for signal QUIT from debugeer
62
log.display("Waiting for signal from debugger: " + getvalues002.QUIT);
63
String signal = pipe.readln();
64
log.display("Received signal from debugger: " + signal);
65
66
// check received signal
67
if (! signal.equals(getvalues002.QUIT)) {
68
log.complain("Unexpected communication signal from debugee: " + signal
69
+ " (expected: " + getvalues002.QUIT + ")");
70
log.display("Debugee FAILED");
71
return getvalues002.FAILED;
72
}
73
74
// exit debugee
75
log.display("Debugee PASSED");
76
return getvalues002.PASSED;
77
}
78
79
// tested class with own static fields values
80
public static class TestedClass {
81
82
// static field with tested array
83
public static Object array[] = null;
84
85
// static fields with object values
86
public static Object nullObject = null;
87
public static Object baseObject = new Object();
88
public static TestedClass derivedObject = new TestedClass();
89
public static String stringObject = new String("string");
90
public static int[] primitiveArrayObject = new int[10];
91
public static Object[] objectArrayObject = new Object[10];
92
public static Thread threadObject = Thread.currentThread();
93
public static ThreadGroup threadGroupObject = threadObject.getThreadGroup();
94
public static Class classObject = derivedObject.getClass();
95
public static ClassLoader classLoaderObject = classObject.getClassLoader();
96
97
public static void setArrayValues() {
98
array = new Object[ARRAY_LENGTH];
99
for (int i = 0; i < ARRAY_LENGTH; i++) {
100
array[i] = null;
101
}
102
103
int i = ARRAY_FIRST_INDEX;
104
array[i + 0] = nullObject;
105
array[i + 1] = baseObject;
106
array[i + 2] = derivedObject;
107
array[i + 3] = stringObject;
108
array[i + 4] = primitiveArrayObject;
109
array[i + 5] = objectArrayObject;
110
array[i + 6] = threadObject;
111
array[i + 7] = threadGroupObject;
112
array[i + 8] = classObject;
113
array[i + 9] = classLoaderObject;
114
}
115
}
116
}
117
118