Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/runtime/LocalVariableTable/TestLVT.java
40942 views
1
/*
2
* Copyright (c) 2015, 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
/*
25
* @test
26
* @bug 8049632
27
* @summary Test ClassFileParser::copy_localvariable_table cases
28
* @library /test/lib
29
* @modules java.base/jdk.internal.misc
30
* java.management
31
* @compile DuplicateLVT.jcod DuplicateLVTT.jcod NotFoundLVTT.jcod
32
* @compile -g -XDignore.symbol.file TestLVT.java
33
* @run main TestLVT
34
*/
35
36
import jdk.test.lib.process.ProcessTools;
37
import jdk.test.lib.process.OutputAnalyzer;
38
import java.util.*;
39
40
public class TestLVT {
41
public static void main(String[] args) throws Exception {
42
test(); // Test good LVT in this test
43
44
String jarFile = System.getProperty("test.src") + "/testcase.jar";
45
46
// java -cp $testSrc/testcase.jar DuplicateLVT
47
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("DuplicateLVT");
48
new OutputAnalyzer(pb.start())
49
.shouldContain("Duplicated LocalVariableTable attribute entry for 'by' in class file DuplicateLVT")
50
.shouldHaveExitValue(1);
51
52
// java -cp $testclasses/testcase.jar DuplicateLVTT
53
pb = ProcessTools.createJavaProcessBuilder("DuplicateLVTT");
54
new OutputAnalyzer(pb.start())
55
.shouldContain("Duplicated LocalVariableTypeTable attribute entry for 'list' in class file DuplicateLVTT")
56
.shouldHaveExitValue(1);
57
58
// java -cp $testclasses/testcase.jar NotFoundLVTT
59
pb = ProcessTools.createJavaProcessBuilder("NotFoundLVTT");
60
new OutputAnalyzer(pb.start())
61
.shouldContain("LVTT entry for 'list' in class file NotFoundLVTT does not match any LVT entry")
62
.shouldHaveExitValue(1);
63
}
64
65
public static void test() {
66
boolean b = true;
67
byte by = 0x42;
68
char c = 'X';
69
double d = 1.1;
70
float f = (float) 1.2;
71
int i = 42;
72
long l = 0xCAFEBABE;
73
short s = 88;
74
ArrayList<String> list = new ArrayList<String>();
75
list.add("me");
76
77
System.out.println("b=" + b);
78
System.out.println("by=" + by);
79
System.out.println("c=" + c);
80
System.out.println("d=" + d);
81
System.out.println("f=" + f);
82
System.out.println("i=" + i);
83
System.out.println("l=" + l);
84
System.out.println("s=" + s);
85
System.out.println("ArrayList<String>=" + list);
86
}
87
}
88
89