Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/lang/instrument/ManifestTestApp.java
41149 views
1
/*
2
* Copyright (c) 2008, 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
public class ManifestTestApp {
25
public static void main(String args[]) {
26
System.out.println("Hello from ManifestTestApp!");
27
28
new ManifestTestApp().doTest();
29
System.exit(0);
30
}
31
32
private void doTest() {
33
try {
34
// load the class only found via the Boot-Class-Path attribute
35
Object instance = loadExampleClass();
36
if (instance.getClass().getClassLoader() == null) {
37
System.out.println("PASS: ExampleForBootClassPath was loaded" +
38
" by the boot class path loader.");
39
} else {
40
System.out.println("FAIL: ExampleForBootClassPath was loaded" +
41
" by a non-boot class path loader.");
42
System.exit(1);
43
}
44
} catch (NoClassDefFoundError ncdfe) {
45
// This message just lets ManifestTest.sh know whether or
46
// not ExampleForBootClassPath was loaded. Depending on
47
// the current test case, that will be either a PASSing
48
// condition or a FAILing condition as determined by
49
// ManifestTest.sh.
50
System.out.println("ExampleForBootClassPath was not loaded.");
51
}
52
}
53
54
Object loadExampleClass() {
55
ExampleForBootClassPath instance = new ExampleForBootClassPath();
56
System.out.println("ExampleForBootClassPath was loaded.");
57
if (instance.fifteen() == 15) {
58
System.out.println("PASS: the correct" +
59
" ExampleForBootClassPath was loaded.");
60
} else {
61
System.out.println("FAIL: the wrong ExampleForBootClassPath" +
62
" was loaded.");
63
System.out.println("FAIL: instance.fifteen()=" +
64
instance.fifteen());
65
System.exit(1);
66
}
67
return instance;
68
}
69
}
70
71