Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007.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.GetClassFields;
25
26
import java.io.PrintStream;
27
28
public class getclfld007 {
29
30
final static int JCK_STATUS_BASE = 95;
31
32
static {
33
try {
34
System.loadLibrary("getclfld007");
35
} catch (UnsatisfiedLinkError ule) {
36
System.err.println("Could not load getclfld007 library");
37
System.err.println("java.library.path:"
38
+ System.getProperty("java.library.path"));
39
throw ule;
40
}
41
}
42
43
native static void check(int i, Class cls);
44
native static int getRes();
45
46
public static void main(String args[]) {
47
args = nsk.share.jvmti.JVMTITest.commonInit(args);
48
49
// produce JCK-like exit status.
50
System.exit(run(args, System.out) + JCK_STATUS_BASE);
51
}
52
53
public static int run(String args[], PrintStream out) {
54
try {
55
check(0, Class.forName(InnerClass1.class.getName()));
56
check(1, Class.forName(InnerInterface.class.getName()));
57
check(2, Class.forName(InnerClass2.class.getName()));
58
check(3, Class.forName(OuterClass1.class.getName()));
59
check(4, Class.forName(OuterClass2.class.getName()));
60
check(5, Class.forName(OuterClass3.class.getName()));
61
check(6, Class.forName(OuterInterface1.class.getName()));
62
check(7, Class.forName(OuterInterface2.class.getName()));
63
check(8, Class.forName(OuterClass4.class.getName()));
64
check(9, Class.forName(OuterClass5.class.getName()));
65
} catch (ClassNotFoundException e) {
66
throw new RuntimeException(e);
67
}
68
return getRes();
69
}
70
71
static class InnerClass1 {
72
String fld_1;
73
void meth(String s) {
74
fld_1 = s;
75
}
76
}
77
78
static interface InnerInterface {
79
int fld_n1 = 1;
80
public void meth();
81
}
82
83
static class InnerClass2 implements InnerInterface {
84
static int fld_n2 = 0;
85
public void meth() {
86
fld_n2++;
87
}
88
}
89
}
90
91
class OuterClass1 extends getclfld007 {
92
}
93
94
class OuterClass2 extends OuterClass1 {
95
int fld_o2;
96
}
97
98
class OuterClass3 {
99
int fld_o3;
100
int meth() {
101
return 3;
102
}
103
}
104
105
interface OuterInterface1 {
106
int fld_i1 = 0;
107
int meth_i1();
108
}
109
110
interface OuterInterface2 extends OuterInterface1 {
111
int fld_i2 = 0;
112
int meth_i2();
113
}
114
115
abstract class OuterClass4 extends OuterClass3 implements OuterInterface2 {
116
int fld_i2 = 2;
117
public int meth_i2() {
118
return 2;
119
}
120
}
121
122
class OuterClass5 extends OuterClass4 {
123
int fld_i1 = 1;
124
public int meth_i1() {
125
return 1;
126
}
127
}
128
129