Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled002a.java
41161 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.jdi.EventRequest.setEnabled;
25
26
import nsk.share.*;
27
import nsk.share.jpda.*;
28
import nsk.share.jdi.*;
29
30
/**
31
* This class is used as debuggee application for the setenabled002 JDI test.
32
*/
33
34
public class setenabled002a {
35
36
//----------------------------------------------------- templete section
37
38
static final int PASSED = 0;
39
static final int FAILED = 2;
40
static final int PASS_BASE = 95;
41
42
static ArgumentHandler argHandler;
43
static Log log;
44
45
//-------------------------------------------------- log procedures
46
47
public static void log1(String message) {
48
log.display("**> debuggee: " + message);
49
}
50
51
private static void logErr(String message) {
52
log.complain("**> debuggee: " + message);
53
}
54
55
//====================================================== test program
56
57
static setenabled002aThread1 thread1 = null;
58
59
static setenabled002aTestClass11 obj = new setenabled002aTestClass11();
60
61
static NullPointerException excObj = new NullPointerException();
62
63
//------------------------------------------------------ common section
64
65
static int exitCode = PASSED;
66
67
static int instruction = 1;
68
static int end = 0;
69
// static int quit = 0;
70
// static int continue = 2;
71
static int maxInstr = 1; // 2;
72
73
static int lineForComm = 2;
74
75
private static void methodForCommunication() {
76
int i1 = instruction;
77
int i2 = i1;
78
int i3 = i2;
79
}
80
//---------------------------------------------------- main method
81
82
public static void main (String argv[]) {
83
84
argHandler = new ArgumentHandler(argv);
85
log = argHandler.createDebugeeLog();
86
87
log1("debuggee started!");
88
89
label0:
90
for (int i = 0; ; i++) {
91
92
if (instruction > maxInstr) {
93
logErr("ERROR: unexpected instruction: " + instruction);
94
exitCode = FAILED;
95
break ;
96
}
97
98
switch (i) {
99
100
//------------------------------------------------------ section tested
101
102
case 0:
103
thread1 = new setenabled002aThread1("thread1");
104
105
synchronized (lockObj) {
106
threadStart(thread1);
107
log1("methodForCommunication();----");
108
methodForCommunication();
109
}
110
try {
111
thread1.join();
112
log1("methodForCommunication();----2");
113
methodForCommunication();
114
} catch ( InterruptedException e ) {
115
}
116
i++;
117
118
case 1:
119
break;
120
case 2:
121
break;
122
case 3:
123
break;
124
case 4:
125
break;
126
case 5:
127
break;
128
case 6:
129
break;
130
case 7:
131
break;
132
case 8:
133
break;
134
case 9:
135
break;
136
case 10:
137
break;
138
case 11:
139
break;
140
141
//------------------------------------------------- standard end section
142
143
default:
144
instruction = end;
145
break;
146
}
147
148
149
log1("methodForCommunication();");
150
methodForCommunication();
151
if (instruction == end)
152
break;
153
154
155
}
156
157
log1("debuggee exits");
158
System.exit(exitCode + PASS_BASE);
159
}
160
161
static Object lockObj = new Object();
162
static Object waitnotifyObj = new Object();
163
164
static int threadStart(Thread t) {
165
synchronized (waitnotifyObj) {
166
t.start();
167
try {
168
waitnotifyObj.wait();
169
} catch ( Exception e) {
170
exitCode = FAILED;
171
logErr(" Exception : " + e );
172
return FAILED;
173
}
174
}
175
return PASSED;
176
}
177
}
178
179
class setenabled002aTestClass10{
180
181
static int var101 = 0;
182
static int var102 = 0;
183
static int var103 = 0;
184
185
static void method10 () {
186
setenabled002a.log1("entered: method10");
187
var101 = 1;
188
var103 = var101;
189
var102 = var103;
190
191
}
192
}
193
class setenabled002aTestClass11 extends setenabled002aTestClass10{
194
195
static int var111 = 0;
196
static int var112 = 0;
197
static int var113 = 0;
198
199
static void method11 () {
200
setenabled002a.log1("entered: method11");
201
var101 = 1;
202
var103 = var101;
203
var102 = var103;
204
205
var111 = 1;
206
var113 = var111;
207
var112 = var113;
208
}
209
}
210
211
class setenabled002aThread1 extends Thread {
212
213
String tName = null;
214
215
public setenabled002aThread1(String threadName) {
216
super(threadName);
217
tName = threadName;
218
}
219
220
public void run() {
221
setenabled002a.log1(" 'run': enter :: threadName == " + tName);
222
synchronized(setenabled002a.waitnotifyObj) {
223
setenabled002a.waitnotifyObj.notify();
224
}
225
synchronized(setenabled002a.lockObj) {
226
setenabled002aTestClass11.method11();
227
}
228
setenabled002a.log1(" 'run': exit :: threadName == " + tName);
229
return;
230
}
231
}
232
233