Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/init/init02/init02.java
40948 views
1
/*
2
* Copyright (c) 2008, 2020, 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
The init02.java test checks if a JIT changes the order in which
25
classes are initialized. Java semantics do not allow a class to be
26
initialized until it is actually used.
27
*/
28
29
30
/*
31
* @test
32
*
33
* @summary converted from VM Testbase jit/init/init02.
34
* VM Testbase keywords: [jit, quick]
35
*
36
* @library /vmTestbase
37
* /test/lib
38
* @run main/othervm jit.init.init02.init02
39
*/
40
41
package jit.init.init02;
42
43
import nsk.share.TestFailure;
44
45
public class init02 {
46
public static boolean failed = false;
47
public static void main(String args[]) {
48
int i, x;
49
for (i = 0; i < 10; i++) {
50
x = i * 10;
51
if (x < 0) {
52
inittest.foo(x);
53
}
54
}
55
56
if (failed)
57
throw new TestFailure("\n\nInitializing inittest, test FAILS\n");
58
}
59
}
60
61
class inittest {
62
static {
63
init02.failed = true;
64
}
65
66
public static void foo(int x) {
67
System.out.println("foo value = " + x);
68
}
69
}
70
71