author | mchung |
Wed, 27 May 2015 13:25:18 -0700 | |
changeset 30846 | 2b3f379840f0 |
parent 30730 | d3ce7619db2c |
child 35359 | f04501964016 |
permissions | -rw-r--r-- |
24223
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
2 |
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
24223
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
4 |
* |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
8 |
* |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
13 |
* accompanied this code). |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
14 |
* |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
18 |
* |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
21 |
* questions. |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
22 |
*/ |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
23 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
24 |
/* |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
25 |
* @test |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
26 |
* @summary local variable table attribute test. |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
27 |
* @bug 8040097 |
26100 | 28 |
* @library /tools/lib /tools/javac/lib ../lib |
30846 | 29 |
* @modules jdk.jdeps/com.sun.tools.classfile |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
30 |
* jdk.compiler/com.sun.tools.javac.api |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
31 |
* jdk.compiler/com.sun.tools.javac.file |
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
26100
diff
changeset
|
32 |
* jdk.compiler/com.sun.tools.javac.main |
26100 | 33 |
* @build ToolBox LocalVariableTestBase TestBase InMemoryFileManager |
24223
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
34 |
* @compile -g LocalVariableTableTest.java |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
35 |
* @run main LocalVariableTableTest |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
36 |
*/ |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
37 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
38 |
import com.sun.tools.classfile.Code_attribute; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
39 |
import com.sun.tools.classfile.LocalVariableTable_attribute; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
40 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
41 |
import java.io.IOException; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
42 |
import java.util.Arrays; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
43 |
import java.util.List; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
44 |
import java.util.stream.Stream; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
45 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
46 |
import static java.util.stream.Collectors.toList; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
47 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
48 |
public class LocalVariableTableTest extends LocalVariableTestBase { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
49 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
50 |
public LocalVariableTableTest(Class<?> clazz) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
51 |
super(clazz); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
52 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
53 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
54 |
public static void main(String[] args) throws IOException { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
55 |
new LocalVariableTableTest(LocalVariableTableTest.class).test(); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
56 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
57 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
58 |
@ExpectedLocals(name = "l", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
59 |
@ExpectedLocals(name = "i", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
60 |
public static void onlyTwoCellParameters(double l, long i) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
61 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
62 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
63 |
@ExpectedLocals(name = "l", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
64 |
@ExpectedLocals(name = "dl", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
65 |
@ExpectedLocals(name = "i", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
66 |
@ExpectedLocals(name = "il", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
67 |
@ExpectedLocals(name = "d", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
68 |
@ExpectedLocals(name = "ll", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
69 |
public static void onlyTwoCellLocals(double l, long i, long d) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
70 |
double dl = 1.1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
71 |
long il = 1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
72 |
long ll = 1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
73 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
74 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
75 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
76 |
protected List<VariableTable> getVariableTables(Code_attribute codeAttribute) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
77 |
return Stream.of(codeAttribute.attributes.attrs) |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
78 |
.filter(at -> at instanceof LocalVariableTable_attribute) |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
79 |
.map(at -> (LocalVariableTable_attribute) at) |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
80 |
.map((t) -> new LocalVariableTable(t)).collect(toList()); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
81 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
82 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
83 |
@ExpectedLocals(name = "l", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
84 |
@ExpectedLocals(name = "i", type = "I") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
85 |
@ExpectedLocals(name = "d", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
86 |
@ExpectedLocals(name = "ll", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
87 |
@ExpectedLocals(name = "obj", type = "Ljava/lang/Object;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
88 |
@ExpectedLocals(name = "dd", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
89 |
@ExpectedLocals(name = "bb", type = "B") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
90 |
@ExpectedLocals(name = "this", type = "LLocalVariableTableTest;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
91 |
public double longDoubleOverlap(long l, int i, double d) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
92 |
long ll = 1L; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
93 |
Object obj = 2; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
94 |
double dd = 3.0; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
95 |
byte bb = 0; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
96 |
return l + i + d + ll + Integer.valueOf(obj.toString()) + dd + bb; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
97 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
98 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
99 |
@ExpectedLocals(name = "bool", type = "Z") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
100 |
@ExpectedLocals(name = "b", type = "B") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
101 |
@ExpectedLocals(name = "ch", type = "C") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
102 |
@ExpectedLocals(name = "sh", type = "S") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
103 |
@ExpectedLocals(name = "i", type = "I") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
104 |
@ExpectedLocals(name = "l", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
105 |
@ExpectedLocals(name = "d", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
106 |
@ExpectedLocals(name = "f", type = "F") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
107 |
@ExpectedLocals(name = "ref", type = "Ljava/lang/Integer;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
108 |
@ExpectedLocals(name = "arr", type = "[Ljava/lang/Integer;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
109 |
@ExpectedLocals(name = "this", type = "LLocalVariableTableTest;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
110 |
public void allTypesWithoutParameters() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
111 |
boolean bool = true; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
112 |
byte b = 0x1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
113 |
char ch = 'a'; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
114 |
short sh = 1_1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
115 |
int i = -2; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
116 |
long l = 1L; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
117 |
float f = 1.1f; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
118 |
double d = 0.1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
119 |
Integer ref = 2; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
120 |
Integer[] arr = null; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
121 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
122 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
123 |
@ExpectedLocals(name = "bool", type = "Z") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
124 |
@ExpectedLocals(name = "b", type = "B") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
125 |
@ExpectedLocals(name = "ch", type = "C") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
126 |
@ExpectedLocals(name = "sh", type = "S") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
127 |
@ExpectedLocals(name = "i", type = "I") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
128 |
@ExpectedLocals(name = "l", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
129 |
@ExpectedLocals(name = "d", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
130 |
@ExpectedLocals(name = "f", type = "F") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
131 |
@ExpectedLocals(name = "ref", type = "Ljava/lang/Integer;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
132 |
@ExpectedLocals(name = "this", type = "LLocalVariableTableTest;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
133 |
public void allTypesWithParameters(boolean bool, byte b, char ch) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
134 |
short sh = 1_1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
135 |
int i = -2; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
136 |
long l = 1L; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
137 |
float f = 1.1f; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
138 |
double d = 0.1; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
139 |
Integer ref = 2; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
140 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
141 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
142 |
@ExpectedLocals(name = "list", type = "Ljava/util/List;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
143 |
@ExpectedLocals(name = "list2", type = "[Ljava/util/List;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
144 |
@ExpectedLocals(name = "p", type = "Ljava/lang/Object;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
145 |
@ExpectedLocals(name = "k", type = "Ljava/lang/Integer;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
146 |
@ExpectedLocals(name = "i", type = "I") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
147 |
@ExpectedLocals(name = "this", type = "LLocalVariableTableTest;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
148 |
public <T extends List<Integer>, P, K extends Integer> void genericType(K k) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
149 |
T list = null; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
150 |
int i = 0; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
151 |
P p = null; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
152 |
List<T>[] list2 = null; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
153 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
154 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
155 |
@ExpectedLocals(name = "this", type = "LLocalVariableTableTest;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
156 |
@ExpectedLocals(name = "inWhile", type = "I") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
157 |
@ExpectedLocals(name = "inTry", type = "D") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
158 |
@ExpectedLocals(name = "inSync", type = "F") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
159 |
@ExpectedLocals(name = "inDo", type = "B") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
160 |
@ExpectedLocals(name = "inFor", type = "J") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
161 |
@ExpectedLocals(name = "s", type = "Ljava/util/stream/Stream;") |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
162 |
public void deepScope() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
163 |
{ |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
164 |
while (true) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
165 |
int inWhile = 0; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
166 |
for (long inFor : Arrays.asList(0)) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
167 |
try (Stream<? extends Integer> s = Stream.of(0)) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
168 |
double inTry = 0.0; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
169 |
synchronized (this) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
170 |
float inSync = -1.0f; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
171 |
do { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
172 |
byte inDo = 0; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
173 |
switch (1) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
174 |
default: |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
175 |
short inSwitch = 100; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
176 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
177 |
} while (true); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
178 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
179 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
180 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
181 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
182 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
183 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
184 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
185 |
class LocalVariableTable implements VariableTable { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
186 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
187 |
final LocalVariableTable_attribute att; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
188 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
189 |
public LocalVariableTable(LocalVariableTable_attribute att) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
190 |
this.att = att; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
191 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
192 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
193 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
194 |
public int localVariableTableLength() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
195 |
return att.local_variable_table_length; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
196 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
197 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
198 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
199 |
public List<Entry> entries() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
200 |
return Stream.of(att.local_variable_table).map(LocalVariableTableEntry::new).collect(toList()); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
201 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
202 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
203 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
204 |
public int attributeLength() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
205 |
return att.attribute_length; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
206 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
207 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
208 |
private class LocalVariableTableEntry implements Entry { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
209 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
210 |
final LocalVariableTable_attribute.Entry entry; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
211 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
212 |
private LocalVariableTableEntry(LocalVariableTable_attribute.Entry entry) { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
213 |
this.entry = entry; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
214 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
215 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
216 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
217 |
public int index() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
218 |
return entry.index; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
219 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
220 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
221 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
222 |
public int startPC() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
223 |
return entry.start_pc; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
224 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
225 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
226 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
227 |
public int length() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
228 |
return entry.length; |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
229 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
230 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
231 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
232 |
public String name() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
233 |
return getString(entry.name_index); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
234 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
235 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
236 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
237 |
public String type() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
238 |
return getString(entry.descriptor_index); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
239 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
240 |
|
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
241 |
@Override |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
242 |
public String toString() { |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
243 |
return dump(); |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
244 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
245 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
246 |
} |
90b07e33a49d
8040097: Implement classfile tests for LocalVariableTable and LocalVariableTypeTable attribute.
anazarov
parents:
diff
changeset
|
247 |
} |