Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Field/isTransient/istrans001.java
41161 views
1
/*
2
* Copyright (c) 2000, 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
25
package nsk.jdi.Field.isTransient;
26
27
import nsk.share.*;
28
import nsk.share.jpda.*;
29
import nsk.share.jdi.*;
30
31
import com.sun.jdi.*;
32
import java.util.*;
33
import java.io.*;
34
35
public class istrans001 {
36
final static String IS_TRANS = "transient";
37
final static String NOT_TRANS = "";
38
final static int TOTAL_FIELDS = 216;
39
final static String FIELDS_TYPE_NAME[][] = {
40
{"z0", NOT_TRANS},
41
{"z1", NOT_TRANS},
42
{"z2", NOT_TRANS},
43
{"b0", NOT_TRANS},
44
{"b1", NOT_TRANS},
45
{"b2", NOT_TRANS},
46
{"c0", NOT_TRANS},
47
{"c1", NOT_TRANS},
48
{"c2", NOT_TRANS},
49
{"d0", NOT_TRANS},
50
{"d1", NOT_TRANS},
51
{"d2", NOT_TRANS},
52
{"f0", NOT_TRANS},
53
{"f1", NOT_TRANS},
54
{"f2", NOT_TRANS},
55
{"i0", NOT_TRANS},
56
{"i1", NOT_TRANS},
57
{"i2", NOT_TRANS},
58
{"l0", NOT_TRANS},
59
{"l1", NOT_TRANS},
60
{"l2", NOT_TRANS},
61
62
{"z0T", IS_TRANS},
63
{"z1T", IS_TRANS},
64
{"z2T", IS_TRANS},
65
{"b0T", IS_TRANS},
66
{"b1T", IS_TRANS},
67
{"b2T", IS_TRANS},
68
{"c0T", IS_TRANS},
69
{"c1T", IS_TRANS},
70
{"c2T", IS_TRANS},
71
{"d0T", IS_TRANS},
72
{"d1T", IS_TRANS},
73
{"d2T", IS_TRANS},
74
{"f0T", IS_TRANS},
75
{"f1T", IS_TRANS},
76
{"f2T", IS_TRANS},
77
{"i0T", IS_TRANS},
78
{"i1T", IS_TRANS},
79
{"i2T", IS_TRANS},
80
{"l0T", IS_TRANS},
81
{"l1T", IS_TRANS},
82
{"l2T", IS_TRANS},
83
84
{"lS0", NOT_TRANS},
85
{"lS1", NOT_TRANS},
86
{"lS2", NOT_TRANS},
87
{"lP0", NOT_TRANS},
88
{"lP1", NOT_TRANS},
89
{"lP2", NOT_TRANS},
90
{"lU0", NOT_TRANS},
91
{"lU1", NOT_TRANS},
92
{"lU2", NOT_TRANS},
93
{"lR0", NOT_TRANS},
94
{"lR1", NOT_TRANS},
95
{"lR2", NOT_TRANS},
96
{"lV0", NOT_TRANS},
97
{"lV1", NOT_TRANS},
98
{"lV2", NOT_TRANS},
99
{"lF0", NOT_TRANS},
100
{"lF1", NOT_TRANS},
101
{"lF2", NOT_TRANS},
102
103
{"lS0T", IS_TRANS},
104
{"lS1T", IS_TRANS},
105
{"lS2T", IS_TRANS},
106
{"lP0T", IS_TRANS},
107
{"lP1T", IS_TRANS},
108
{"lP2T", IS_TRANS},
109
{"lU0T", IS_TRANS},
110
{"lU1T", IS_TRANS},
111
{"lU2T", IS_TRANS},
112
{"lR0T", IS_TRANS},
113
{"lR1T", IS_TRANS},
114
{"lR2T", IS_TRANS},
115
{"lV0T", IS_TRANS},
116
{"lV1T", IS_TRANS},
117
{"lV2T", IS_TRANS},
118
{"lF0T", IS_TRANS},
119
{"lF1T", IS_TRANS},
120
{"lF2T", IS_TRANS},
121
122
{"X0", NOT_TRANS},
123
{"X1", NOT_TRANS},
124
{"X2", NOT_TRANS},
125
{"Z0", NOT_TRANS},
126
{"Z1", NOT_TRANS},
127
{"Z2", NOT_TRANS},
128
{"B0", NOT_TRANS},
129
{"B1", NOT_TRANS},
130
{"B2", NOT_TRANS},
131
{"C0", NOT_TRANS},
132
{"C1", NOT_TRANS},
133
{"C2", NOT_TRANS},
134
{"D0", NOT_TRANS},
135
{"D1", NOT_TRANS},
136
{"D2", NOT_TRANS},
137
{"F0", NOT_TRANS},
138
{"F1", NOT_TRANS},
139
{"F2", NOT_TRANS},
140
{"I0", NOT_TRANS},
141
{"I1", NOT_TRANS},
142
{"I2", NOT_TRANS},
143
{"L0", NOT_TRANS},
144
{"L1", NOT_TRANS},
145
{"L2", NOT_TRANS},
146
{"S0", NOT_TRANS},
147
{"S1", NOT_TRANS},
148
{"S2", NOT_TRANS},
149
{"O0", NOT_TRANS},
150
{"O1", NOT_TRANS},
151
{"O2", NOT_TRANS},
152
153
{"X0T", IS_TRANS},
154
{"X1T", IS_TRANS},
155
{"X2T", IS_TRANS},
156
{"Z0T", IS_TRANS},
157
{"Z1T", IS_TRANS},
158
{"Z2T", IS_TRANS},
159
{"B0T", IS_TRANS},
160
{"B1T", IS_TRANS},
161
{"B2T", IS_TRANS},
162
{"C0T", IS_TRANS},
163
{"C1T", IS_TRANS},
164
{"C2T", IS_TRANS},
165
{"D0T", IS_TRANS},
166
{"D1T", IS_TRANS},
167
{"D2T", IS_TRANS},
168
{"F0T", IS_TRANS},
169
{"F1T", IS_TRANS},
170
{"F2T", IS_TRANS},
171
{"I0T", IS_TRANS},
172
{"I1T", IS_TRANS},
173
{"I2T", IS_TRANS},
174
{"L0T", IS_TRANS},
175
{"L1T", IS_TRANS},
176
{"L2T", IS_TRANS},
177
{"S0T", IS_TRANS},
178
{"S1T", IS_TRANS},
179
{"S2T", IS_TRANS},
180
{"O0T", IS_TRANS},
181
{"O1T", IS_TRANS},
182
{"O2T", IS_TRANS},
183
184
{"LS0", NOT_TRANS},
185
{"LS1", NOT_TRANS},
186
{"LS2", NOT_TRANS},
187
{"LP0", NOT_TRANS},
188
{"LP1", NOT_TRANS},
189
{"LP2", NOT_TRANS},
190
{"LU0", NOT_TRANS},
191
{"LU1", NOT_TRANS},
192
{"LU2", NOT_TRANS},
193
{"LR0", NOT_TRANS},
194
{"LR1", NOT_TRANS},
195
{"LR2", NOT_TRANS},
196
{"LV0", NOT_TRANS},
197
{"LV1", NOT_TRANS},
198
{"LV2", NOT_TRANS},
199
{"LF0", NOT_TRANS},
200
{"LF1", NOT_TRANS},
201
{"LF2", NOT_TRANS},
202
203
{"LS0T", IS_TRANS},
204
{"LS1T", IS_TRANS},
205
{"LS2T", IS_TRANS},
206
{"LP0T", IS_TRANS},
207
{"LP1T", IS_TRANS},
208
{"LP2T", IS_TRANS},
209
{"LU0T", IS_TRANS},
210
{"LU1T", IS_TRANS},
211
{"LU2T", IS_TRANS},
212
{"LR0T", IS_TRANS},
213
{"LR1T", IS_TRANS},
214
{"LR2T", IS_TRANS},
215
{"LV0T", IS_TRANS},
216
{"LV1T", IS_TRANS},
217
{"LV2T", IS_TRANS},
218
{"LF0T", IS_TRANS},
219
{"LF1T", IS_TRANS},
220
{"LF2T", IS_TRANS},
221
222
{"E0", NOT_TRANS},
223
{"E1", NOT_TRANS},
224
{"E2", NOT_TRANS},
225
226
{"E0T", IS_TRANS},
227
{"E1T", IS_TRANS},
228
{"E2T", IS_TRANS},
229
230
{"ES0", NOT_TRANS},
231
{"ES1", NOT_TRANS},
232
{"ES2", NOT_TRANS},
233
{"EP0", NOT_TRANS},
234
{"EP1", NOT_TRANS},
235
{"EP2", NOT_TRANS},
236
{"EU0", NOT_TRANS},
237
{"EU1", NOT_TRANS},
238
{"EU2", NOT_TRANS},
239
{"ER0", NOT_TRANS},
240
{"ER1", NOT_TRANS},
241
{"ER2", NOT_TRANS},
242
{"EV0", NOT_TRANS},
243
{"EV1", NOT_TRANS},
244
{"EV2", NOT_TRANS},
245
{"EF0", NOT_TRANS},
246
{"EF1", NOT_TRANS},
247
{"EF2", NOT_TRANS},
248
249
{"ES0T", IS_TRANS},
250
{"ES1T", IS_TRANS},
251
{"ES2T", IS_TRANS},
252
{"EP0T", IS_TRANS},
253
{"EP1T", IS_TRANS},
254
{"EP2T", IS_TRANS},
255
{"EU0T", IS_TRANS},
256
{"EU1T", IS_TRANS},
257
{"EU2T", IS_TRANS},
258
{"ER0T", IS_TRANS},
259
{"ER1T", IS_TRANS},
260
{"ER2T", IS_TRANS},
261
{"EV0T", IS_TRANS},
262
{"EV1T", IS_TRANS},
263
{"EV2T", IS_TRANS},
264
{"EF0T", IS_TRANS},
265
{"EF1T", IS_TRANS},
266
{"EF2T", IS_TRANS}
267
};
268
private static Log log;
269
private final static String prefix = "nsk.jdi.Field.isTransient.";
270
private final static String className = "istrans001";
271
private final static String debugerName = prefix + className;
272
private final static String debugeeName = debugerName + "a";
273
274
public static void main(String argv[]) {
275
System.exit(95 + run(argv, System.out));
276
}
277
278
public static int run(String argv[], PrintStream out) {
279
ArgumentHandler argHandler = new ArgumentHandler(argv);
280
log = new Log(out, argHandler);
281
Binder binder = new Binder(argHandler, log);
282
Debugee debugee = binder.bindToDebugee(debugeeName
283
+ (argHandler.verbose() ? " -verbose" : ""));
284
IOPipe pipe = new IOPipe(debugee);
285
boolean testFailed = false;
286
List fields;
287
288
// Connect with debugee and resume it
289
debugee.redirectStderr(out);
290
debugee.resume();
291
String line = pipe.readln();
292
if (line == null) {
293
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
294
return 2;
295
}
296
if (!line.equals("ready")) {
297
log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
298
+ line);
299
return 2;
300
}
301
else {
302
log.display("debuger> debugee's \"ready\" signal recieved.");
303
}
304
305
// Get all fields from debugee
306
ReferenceType refType = debugee.classByName(debugeeName);
307
if (refType == null) {
308
log.complain("debuger FAILURE> Class " + debugeeName
309
+ " not found.");
310
return 2;
311
}
312
try {
313
fields = refType.allFields();
314
} catch (Exception e) {
315
log.complain("debuger FAILURE> Can't get fields from class");
316
log.complain("debuger FAILURE> Exception: " + e);
317
return 2;
318
}
319
int totalFields = fields.size();
320
if (totalFields < 1) {
321
log.complain("debuger FAILURE> Total number of fields read "
322
+ totalFields + ", should be " + TOTAL_FIELDS);
323
return 2;
324
}
325
log.display("debuger> Total fields found: " + totalFields);
326
Iterator fieldsIterator = fields.iterator();
327
for (int i = 0; fieldsIterator.hasNext(); i++) {
328
Field field = (Field)fieldsIterator.next();
329
boolean isTrans = field.isTransient();
330
String name = field.name();
331
String realIsTrans;
332
333
if (name == null) {
334
log.complain("debuger FAILURE 1> Name is null for " + i
335
+ " field");
336
testFailed = true;
337
continue;
338
}
339
log.display("debuger> " + i + " field (" + name + "), "
340
+ "isTransient = " + isTrans + " read.");
341
try {
342
realIsTrans = getTransByName(name);
343
} catch (Error e) {
344
log.complain("debuger FAILURE 2> Unexpected Error " + e);
345
return 2;
346
}
347
// isTransient() returns true if the field is transient,
348
// returns false if the field is not transient
349
if ((isTrans && !realIsTrans.equals(IS_TRANS)) ||
350
(!isTrans && realIsTrans.equals(IS_TRANS))
351
) {
352
log.complain("debuger FAILURE 3> " + i + " field " + name
353
+ ": read field.isTransient() = " + isTrans
354
+ " real isTransient should be " + realIsTrans);
355
testFailed = true;
356
}
357
}
358
pipe.println("quit");
359
debugee.waitFor();
360
361
int status = debugee.getStatus();
362
if (testFailed) {
363
log.complain("debuger FAILURE> TEST FAILED");
364
return 2;
365
} else {
366
if (status == 95) {
367
log.display("debuger> expected Debugee's exit "
368
+ "status - " + status);
369
return 0;
370
} else {
371
log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
372
+ "status (not 95) - " + status);
373
return 2;
374
}
375
}
376
}
377
378
private static String getTransByName(String name)
379
throws Error
380
{
381
for (int i = 0; i < TOTAL_FIELDS; i++) {
382
String fieldName = FIELDS_TYPE_NAME[i][0];
383
if (fieldName.equals(name)) {
384
return FIELDS_TYPE_NAME[i][1];
385
}
386
}
387
throw new Error("Error in test. Unknown field " + name);
388
}
389
}
390
391