Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001.java
40948 views
1
/*
2
* Copyright (c) 2003, 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.jvmti.ClassLoad;
25
26
import java.io.*;
27
import java.util.*;
28
import nsk.share.*;
29
30
/**
31
* The test exercises the JVMTI event Class Load.<br>
32
* It verifies that the event will be sent for the auxiliary class
33
* <code>TestedClass</code> and array of type <code>TestedClass</code>
34
* and vise versa for primitive classes and arrays of primitive types
35
* in accordance with the ClassLoad spec:<br>
36
* <code>Arrays of non-primitive types have class load events. Arrays of
37
* primitive types do not have class load events. Primitive classes (for
38
* example, java.lang.Integer.TYPE) do not have class load events.</code>
39
*/
40
public class classload001 {
41
static {
42
try {
43
System.loadLibrary("classload001");
44
} catch (UnsatisfiedLinkError ule) {
45
System.err.println("Could not load \"classload001\" library");
46
System.err.println("java.library.path:"
47
+ System.getProperty("java.library.path"));
48
throw ule;
49
}
50
}
51
52
native int check();
53
54
public static void main(String args[]) {
55
args = nsk.share.jvmti.JVMTITest.commonInit(args);
56
57
// produce JCK-like exit status.
58
System.exit(run(args, System.out) + Consts.JCK_STATUS_BASE);
59
}
60
61
public static int run(String args[], PrintStream out) {
62
return new classload001().runIt(args, out);
63
}
64
65
private int runIt(String args[], PrintStream out) {
66
return check();
67
}
68
69
// classes & arrays used to verify an assertion in the agent
70
Class boolCls = Boolean.TYPE;
71
Class byteCls = Byte.TYPE;
72
Class charCls = Character.TYPE;
73
Class doubleCls = Double.TYPE;
74
Class floatCls = Float.TYPE;
75
Class intCls = Integer.TYPE;
76
Class longCls = Long.TYPE;
77
Class shortCls = Short.TYPE;
78
79
Class boolClArr[] = {Boolean.TYPE, Boolean.TYPE};
80
Class byteClArr[] = {Byte.TYPE, Byte.TYPE};
81
Class charClArr[] = {Character.TYPE};
82
Class doubleClArr[] = {Double.TYPE};
83
Class floatClArr[] = {Float.TYPE, Float.TYPE};
84
Class intClArr[] = {Integer.TYPE};
85
Class longClArr[] = {Long.TYPE};
86
Class shortClArr[] = {Short.TYPE, Short.TYPE};
87
88
boolean boolArr[] = {false, true};
89
byte byteArr[] = {Byte.MAX_VALUE};
90
char charArr[] = {'a'};
91
double doubleArr[] = {Double.MIN_VALUE};
92
float floatArr[] = {Float.MAX_VALUE};
93
int intArr[] = {Integer.MIN_VALUE};
94
long longArr[] = {Long.MAX_VALUE};
95
short shortArr[] = {Short.MIN_VALUE};
96
97
TestedClass testedCls[] = {new TestedClass()};
98
99
class TestedClass {}
100
}
101
102