Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/Event/hashCode/hashcode001a.java
41161 views
1
/*
2
* Copyright (c) 2002, 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
package nsk.jdi.Event.hashCode;
24
25
import nsk.share.*;
26
import nsk.share.jpda.*;
27
import nsk.share.jdi.*;
28
29
// THIS TEST IS LINE NUMBER SENSITIVE
30
/**
31
* The debugged application of the test.
32
*/
33
public class hashcode001a {
34
35
//------------------------------------------------------- immutable common fields
36
37
private static int exitStatus;
38
private static ArgumentHandler argHandler;
39
private static Log log;
40
private static IOPipe pipe;
41
42
//------------------------------------------------------- immutable common methods
43
44
static void display(String msg) {
45
log.display("debuggee > " + msg);
46
}
47
48
static void complain(String msg) {
49
log.complain("debuggee FAILURE > " + msg);
50
}
51
52
public static void receiveSignal(String signal) {
53
String line = pipe.readln();
54
55
if ( !line.equals(signal) )
56
throw new Failure("UNEXPECTED debugger's signal " + line);
57
58
display("debugger's <" + signal + "> signal received.");
59
}
60
61
//------------------------------------------------------ mutable common fields
62
63
//------------------------------------------------------ test specific fields
64
65
static Object lock = new Object();
66
static Object wait = new Object();
67
68
//------------------------------------------------------ mutable common method
69
70
public static void main (String argv[]) {
71
exitStatus = Consts.TEST_FAILED;
72
argHandler = new ArgumentHandler(argv);
73
log = new Log(System.err, argHandler);
74
pipe = argHandler.createDebugeeIOPipe(log);
75
try {
76
Thread thread1 = new hashcode001aThread("thread1");
77
78
synchronized (lock) {
79
synchronized(wait) {
80
thread1.start();
81
try {
82
wait.wait();
83
pipe.println(hashcode001.SIGNAL_READY);
84
} catch (InterruptedException e) {
85
throw new Failure("Unexpected InterruptedException while waiting for notification");
86
}
87
}
88
receiveSignal(hashcode001.SIGNAL_GO);
89
}
90
try {
91
thread1.join();
92
} catch (InterruptedException e) {
93
throw new Failure("Unexpected InterruptedException while waiting for thread1 join");
94
}
95
96
// receiveSignal(hashcode001.SIGNAL_QUIT);
97
display("completed succesfully.");
98
System.exit(Consts.TEST_PASSED + Consts.JCK_STATUS_BASE);
99
} catch (Failure e) {
100
log.complain(e.getMessage());
101
System.exit(Consts.TEST_FAILED + Consts.JCK_STATUS_BASE);
102
}
103
}
104
105
//--------------------------------------------------------- test specific methods
106
107
}
108
109
//--------------------------------------------------------- test specific classes
110
111
class hashcode001aThread extends Thread {
112
113
String name;
114
115
public hashcode001aThread (String name) {
116
super(name);
117
this.name = name;
118
}
119
120
public void run() {
121
synchronized (hashcode001a.wait) {
122
hashcode001a.wait.notifyAll();
123
}
124
synchronized (hashcode001a.lock) {
125
}
126
127
foo();
128
129
hashcode001aThread1 thread2 = new hashcode001aThread1();
130
thread2.start();
131
132
try {
133
throw new Exception();
134
} catch (Exception e) {
135
}
136
137
try {
138
thread2.join();
139
} catch (InterruptedException e) {
140
throw new Failure("Unexpected InterruptedException while waiting for thread2 join");
141
}
142
}
143
144
void foo () {
145
name = "afterFoo"; // hashcode001.brkpLineNumber
146
hashcode001a.display("thread1's name == " + name);
147
}
148
}
149
150
class hashcode001aThread1 extends Thread {
151
public void run() {
152
}
153
}
154
155