Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassLoaderReference/visibleClasses/visibleclasses001a.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.ClassLoaderReference.visibleClasses;
25
26
import nsk.share.*;
27
import nsk.share.jpda.*;
28
import nsk.share.jdi.*;
29
30
import java.net.URLClassLoader;
31
import java.net.URL;
32
33
/**
34
* This class is used as debuggee application for the visibleclasses001 JDI test.
35
*/
36
37
public class visibleclasses001a {
38
39
//----------------------------------------------------- templete section
40
41
static final int PASSED = 0;
42
static final int FAILED = 2;
43
static final int PASS_BASE = 95;
44
45
static ArgumentHandler argHandler;
46
static Log log;
47
48
//-------------------------------------------------- log procedures
49
50
private static void log1(String message) {
51
log.display("**> debuggee: " + message);
52
}
53
54
private static void logErr(String message) {
55
log.complain("**> debuggee: " + message);
56
}
57
58
//====================================================== test program
59
60
static ClassLoader classLoader = null;
61
62
static String urlString = "http://x.y.z/";
63
64
//------------------------------------------------------ common section
65
static int instruction = 1;
66
static int end = 0;
67
// static int quit = 0;
68
// static int continue = 2;
69
static int maxInstr = 1; // 2;
70
71
static int lineForComm = 2;
72
73
private static void methodForCommunication() {
74
int i1 = instruction;
75
int i2 = i1;
76
int i3 = i2;
77
}
78
//---------------------------------------------------- main method
79
80
public static void main (String argv[]) {
81
82
argHandler = new ArgumentHandler(argv);
83
log = argHandler.createDebugeeLog();
84
85
log1("debuggee started!");
86
87
int exitCode = PASSED;
88
89
90
label0:
91
for (int i = 0; ; i++) {
92
93
if (instruction > maxInstr) {
94
logErr("ERROR: unexpected instruction: " + instruction);
95
exitCode = FAILED;
96
break ;
97
}
98
99
switch (i) {
100
101
//------------------------------------------------------ section tested
102
103
case 0:
104
methodForCommunication();
105
break ;
106
107
case 1:
108
try {
109
URL[] url = { new URL(urlString) } ;
110
classLoader = new URLClassLoader(url);
111
} catch ( Exception e ) {
112
log1("Exception : " + e);
113
}
114
115
methodForCommunication();
116
break ;
117
//------------------------------------------------- standard end section
118
119
default:
120
instruction = end;
121
methodForCommunication();
122
break label0;
123
}
124
}
125
126
System.exit(exitCode + PASS_BASE);
127
}
128
}
129
130