author | mcimadamore |
Wed, 26 Oct 2016 15:41:25 +0100 | |
changeset 41856 | 13a056e8f16e |
parent 30846 | 2b3f379840f0 |
child 42822 | a84956e7ee4d |
permissions | -rw-r--r-- |
20267
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
22444
diff
changeset
|
2 |
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
20267
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
4 |
* |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
8 |
* |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
13 |
* accompanied this code). |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
14 |
* |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
18 |
* |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
21 |
* questions. |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
22 |
*/ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
23 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
24 |
/* |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
25 |
* @test |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
26 |
* @bug 8011738 |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
27 |
* @author sogoel |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
28 |
* @summary Code translation test for Lambda expressions, method references |
30846 | 29 |
* @modules jdk.jdeps/com.sun.tools.classfile |
20267
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
30 |
* @run main ByteCodeTest |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
31 |
*/ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
32 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
33 |
import com.sun.tools.classfile.Attribute; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
34 |
import com.sun.tools.classfile.BootstrapMethods_attribute; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
35 |
import com.sun.tools.classfile.ClassFile; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
36 |
import com.sun.tools.classfile.ConstantPool; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
37 |
import com.sun.tools.classfile.ConstantPoolException; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
38 |
import com.sun.tools.classfile.ConstantPool.*; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
39 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
40 |
import java.io.BufferedWriter; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
41 |
import java.io.File; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
42 |
import java.io.FileWriter; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
43 |
import java.io.IOException; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
44 |
import java.io.PrintWriter; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
45 |
import java.util.ArrayList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
46 |
import java.util.Collections; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
47 |
import java.util.HashMap; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
48 |
import java.util.HashSet; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
49 |
import java.util.List; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
50 |
import java.util.Map; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
51 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
52 |
public class ByteCodeTest { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
53 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
54 |
static boolean IS_DEBUG = false; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
55 |
public static void main(String[] args) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
56 |
File classFile = null; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
57 |
int err = 0; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
58 |
boolean verifyResult = false; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
59 |
for(TestCases tc : TestCases.values()) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
60 |
classFile = getCompiledFile(tc.name(), tc.srcCode); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
61 |
if(classFile == null) { // either testFile or classFile was not created |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
62 |
err++; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
63 |
} else { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
64 |
verifyResult = verifyClassFileAttributes(classFile, tc); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
65 |
if(!verifyResult) |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
66 |
System.out.println("Bootstrap class file attributes did not match for " + tc.name()); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
67 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
68 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
69 |
if(err > 0) |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
70 |
throw new RuntimeException("Found " + err + " found"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
71 |
else |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
72 |
System.out.println("Test passed"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
73 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
74 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
75 |
private static boolean verifyClassFileAttributes(File classFile, TestCases tc) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
76 |
ClassFile c = null; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
77 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
78 |
c = ClassFile.read(classFile); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
79 |
} catch (IOException | ConstantPoolException e) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
80 |
e.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
81 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
82 |
ConstantPoolVisitor cpv = new ConstantPoolVisitor(c, c.constant_pool.size()); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
83 |
Map<Integer, String> hm = cpv.getBSMMap(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
84 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
85 |
List<String> expectedValList = tc.getExpectedArgValues(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
86 |
expectedValList.add(tc.bsmSpecifier.specifier); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
87 |
if(!(hm.values().containsAll(new HashSet<String>(expectedValList)))) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
88 |
System.out.println("Values do not match"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
89 |
return false; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
90 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
91 |
return true; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
92 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
93 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
94 |
private static File getCompiledFile(String fname, String srcString) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
95 |
File testFile = null, classFile = null; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
96 |
boolean isTestFileCreated = true; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
97 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
98 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
99 |
testFile = writeTestFile(fname+".java", srcString); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
100 |
} catch(IOException ioe) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
101 |
isTestFileCreated = false; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
102 |
System.err.println("fail to write" + ioe); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
103 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
104 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
105 |
if(isTestFileCreated) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
106 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
107 |
classFile = compile(testFile); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
108 |
} catch (Error err) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
109 |
System.err.println("fail compile. Source:\n" + srcString); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
110 |
throw err; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
111 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
112 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
113 |
return classFile; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
114 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
115 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
116 |
static File writeTestFile(String fname, String source) throws IOException { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
117 |
File f = new File(fname); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
118 |
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(f))); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
119 |
out.println(source); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
120 |
out.close(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
121 |
return f; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
122 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
123 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
124 |
static File compile(File f) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
125 |
int rc = com.sun.tools.javac.Main.compile(new String[] { |
22444
c79ee1e6742f
8031745: Remove unneeded/obsolete -source/-target options in javac tests, part 1
darcy
parents:
20267
diff
changeset
|
126 |
"-g", f.getPath() }); |
20267
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
127 |
if (rc != 0) |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
128 |
throw new Error("compilation failed. rc=" + rc); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
129 |
String path = f.getPath(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
130 |
return new File(path.substring(0, path.length() - 5) + ".class"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
131 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
132 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
133 |
static void debugln(String str) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
134 |
if(IS_DEBUG) |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
135 |
System.out.println(str); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
136 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
137 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
138 |
enum BSMSpecifier { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
139 |
SPECIFIER1("REF_invokeStatic java/lang/invoke/LambdaMetafactory metaFactory " + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
140 |
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
141 |
"Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
142 |
"Ljava/lang/invoke/CallSite;"), |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
143 |
SPECIFIER2("REF_invokeStatic java/lang/invoke/LambdaMetafactory altMetaFactory " + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
144 |
"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
145 |
"[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
146 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
147 |
String specifier; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
148 |
private BSMSpecifier(String specifier) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
149 |
this.specifier = specifier; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
150 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
151 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
152 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
153 |
enum TestCases { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
154 |
// Single line lambda expression |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
155 |
TC1("class TC1 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
156 |
" public static void main(String[] args) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
157 |
" Object o = (Runnable) () -> { System.out.println(\"hi\");};\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
158 |
" }\n"+ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
159 |
"}", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
160 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
161 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
162 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
163 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
164 |
valList.add("REF_invokeInterface java/lang/Runnable run ()V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
165 |
valList.add("REF_invokeStatic TC1 lambda$0 ()V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
166 |
valList.add("()V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
167 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
168 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
169 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
170 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
171 |
// Lambda expression in a for loop |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
172 |
TC2("import java.util.*;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
173 |
"public class TC2 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
174 |
" void TC2_test() {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
175 |
" List<String> list = new ArrayList<>();\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
176 |
" list.add(\"A\");\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
177 |
" list.add(\"B\");\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
178 |
" list.stream().forEach( s -> { System.out.println(s); } );\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
179 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
180 |
" public static void main(String[] args) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
181 |
" new TC2().TC2_test();\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
182 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
183 |
"}", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
184 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
185 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
186 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
187 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
188 |
valList.add("REF_invokeInterface java/util/function/Consumer accept (Ljava/lang/Object;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
189 |
valList.add("REF_invokeStatic TC2 lambda$0 (Ljava/lang/String;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
190 |
valList.add("(Ljava/lang/String;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
191 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
192 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
193 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
194 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
195 |
// Lambda initializer |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
196 |
TC3("class TC3 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
197 |
" interface SAM {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
198 |
" void m(int i);\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
199 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
200 |
" SAM lambda_03 = (int pos) -> { };\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
201 |
"}", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
202 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
203 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
204 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
205 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
206 |
valList.add("REF_invokeInterface TC3$SAM m (I)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
207 |
valList.add("REF_invokeStatic TC3 lambda$0 (I)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
208 |
valList.add("(I)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
209 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
210 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
211 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
212 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
213 |
// Array initializer |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
214 |
TC4("class TC4 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
215 |
" interface Block<T> {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
216 |
" void m(T t);\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
217 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
218 |
" void test1() {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
219 |
" Block<?>[] arr1 = { t -> { }, t -> { } };\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
220 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
221 |
"}", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
222 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
223 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
224 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
225 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
226 |
valList.add("REF_invokeInterface TC4$Block m (Ljava/lang/Object;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
227 |
valList.add("REF_invokeStatic TC4 lambda$0 (Ljava/lang/Object;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
228 |
valList.add("(Ljava/lang/Object;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
229 |
valList.add("REF_invokeStatic TC4 lambda$1 (Ljava/lang/Object;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
230 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
231 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
232 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
233 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
234 |
//Lambda expression as a method arg |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
235 |
TC5("class TC5 {\n"+ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
236 |
" interface MapFun<T,R> { R m( T n); }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
237 |
" void meth( MapFun<String,Integer> mf ) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
238 |
" assert( mf.m(\"four\") == 4);\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
239 |
" }\n"+ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
240 |
" void test(Integer i) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
241 |
" meth(s -> { Integer len = s.length(); return len; } );\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
242 |
" }\n"+ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
243 |
"}", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
244 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
245 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
246 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
247 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
248 |
valList.add("REF_invokeInterface TC5$MapFun m (Ljava/lang/Object;)Ljava/lang/Object;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
249 |
valList.add("REF_invokeStatic TC5 lambda$0 (Ljava/lang/String;)Ljava/lang/Integer;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
250 |
valList.add("(Ljava/lang/String;)Ljava/lang/Integer;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
251 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
252 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
253 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
254 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
255 |
//Inner class of Lambda expression |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
256 |
TC6("class TC6 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
257 |
" interface MapFun<T, R> { R m( T n); }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
258 |
" MapFun<Class<?>,String> cs;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
259 |
" void test() {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
260 |
" cs = c -> {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
261 |
" class innerClass {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
262 |
" Class<?> icc;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
263 |
" innerClass(Class<?> _c) { icc = _c; }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
264 |
" String getString() { return icc.toString(); }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
265 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
266 |
" return new innerClass(c).getString();\n"+ |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
267 |
" };\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
268 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
269 |
"}\n", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
270 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
271 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
272 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
273 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
274 |
valList.add("REF_invokeInterface TC6$MapFun m (Ljava/lang/Object;)Ljava/lang/Object;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
275 |
valList.add("REF_invokeSpecial TC6 lambda$0 (Ljava/lang/Class;)Ljava/lang/String;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
276 |
valList.add("(Ljava/lang/Class;)Ljava/lang/String;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
277 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
278 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
279 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
280 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
281 |
// Method reference |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
282 |
TC7("class TC7 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
283 |
" static interface SAM {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
284 |
" void m(Integer i);\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
285 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
286 |
" void m(Integer i) {}\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
287 |
" SAM s = this::m;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
288 |
"}\n", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
289 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
290 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
291 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
292 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
293 |
valList.add("REF_invokeInterface TC7$SAM m (Ljava/lang/Integer;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
294 |
valList.add("REF_invokeVirtual TC7 m (Ljava/lang/Integer;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
295 |
valList.add("(Ljava/lang/Integer;)V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
296 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
297 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
298 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
299 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
300 |
// Constructor reference |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
301 |
TC8("public class TC8 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
302 |
" static interface A {Fee<String> m();}\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
303 |
" static class Fee<T> {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
304 |
" private T t;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
305 |
" public Fee() {}\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
306 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
307 |
" public static void main(String[] args) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
308 |
" A a = Fee<String>::new; \n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
309 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
310 |
"}\n", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
311 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
312 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
313 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
314 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
315 |
valList.add("REF_invokeInterface TC8$A m ()LTC8$Fee;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
316 |
valList.add("REF_newInvokeSpecial TC8$Fee <init> ()V"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
317 |
valList.add("()LTC8$Fee;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
318 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
319 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
320 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
321 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
322 |
// Recursive lambda expression |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
323 |
TC9("class TC9 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
324 |
" interface Recursive<T, R> { T apply(R n); };\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
325 |
" Recursive<Integer,Integer> factorial;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
326 |
" void test(Integer j) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
327 |
" factorial = i -> { return i == 0 ? 1 : i * factorial.apply( i - 1 ); };\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
328 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
329 |
"}\n", BSMSpecifier.SPECIFIER1) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
330 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
331 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
332 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
333 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
334 |
valList.add("REF_invokeInterface TC9$Recursive apply (Ljava/lang/Object;)Ljava/lang/Object;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
335 |
valList.add("REF_invokeSpecial TC9 lambda$0 (Ljava/lang/Integer;)Ljava/lang/Integer;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
336 |
valList.add("(Ljava/lang/Integer;)Ljava/lang/Integer;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
337 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
338 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
339 |
}, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
340 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
341 |
//Serializable Lambda |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
342 |
TC10("import java.io.Serializable;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
343 |
"class TC10 {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
344 |
" interface Foo { int m(); }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
345 |
" public static void main(String[] args) {\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
346 |
" Foo f1 = (Foo & Serializable)() -> 3;\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
347 |
" }\n" + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
348 |
"}\n", BSMSpecifier.SPECIFIER2) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
349 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
350 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
351 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
352 |
List<String> valList = new ArrayList<>(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
353 |
valList.add("REF_invokeStatic java/lang/invoke/LambdaMetafactory altMetaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
354 |
valList.add("REF_invokeInterface TC10$Foo m ()I"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
355 |
valList.add("REF_invokeStatic TC10 lambda$main$3231c38a$0 ()I"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
356 |
valList.add("()I"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
357 |
valList.add("1"); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
358 |
return valList; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
359 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
360 |
}; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
361 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
362 |
String srcCode; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
363 |
BSMSpecifier bsmSpecifier; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
364 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
365 |
TestCases(String src, BSMSpecifier bsmSpecifier) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
366 |
this.srcCode = src; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
367 |
// By default, all test cases will have bootstrap method specifier as Lambda.MetaFactory |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
368 |
// For serializable lambda test cases, bootstrap method specifier changed to altMetaFactory |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
369 |
this.bsmSpecifier = bsmSpecifier; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
370 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
371 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
372 |
List<String> getExpectedArgValues() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
373 |
return null; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
374 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
375 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
376 |
void setSrcCode(String src) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
377 |
srcCode = src; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
378 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
379 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
380 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
381 |
static class ConstantPoolVisitor implements ConstantPool.Visitor<String, Integer> { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
382 |
final List<String> slist; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
383 |
final ClassFile cf; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
384 |
final ConstantPool cfpool; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
385 |
final Map<Integer, String> bsmMap; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
386 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
387 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
388 |
public ConstantPoolVisitor(ClassFile cf, int size) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
389 |
slist = new ArrayList<>(size); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
390 |
for (int i = 0 ; i < size; i++) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
391 |
slist.add(null); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
392 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
393 |
this.cf = cf; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
394 |
this.cfpool = cf.constant_pool; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
395 |
bsmMap = readBSM(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
396 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
397 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
398 |
public Map<Integer, String> getBSMMap() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
399 |
return Collections.unmodifiableMap(bsmMap); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
400 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
401 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
402 |
public String visit(CPInfo c, int index) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
403 |
return c.accept(this, index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
404 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
405 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
406 |
private Map<Integer, String> readBSM() { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
407 |
BootstrapMethods_attribute bsmAttr = |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
408 |
(BootstrapMethods_attribute) cf.getAttribute(Attribute.BootstrapMethods); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
409 |
if (bsmAttr != null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
410 |
Map<Integer, String> out = |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
411 |
new HashMap<>(bsmAttr.bootstrap_method_specifiers.length); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
412 |
for (BootstrapMethods_attribute.BootstrapMethodSpecifier bsms : |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
413 |
bsmAttr.bootstrap_method_specifiers) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
414 |
int index = bsms.bootstrap_method_ref; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
415 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
416 |
String value = slist.get(index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
417 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
418 |
value = visit(cfpool.get(index), index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
419 |
debugln("[SG]: index " + index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
420 |
debugln("[SG]: value " + value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
421 |
slist.set(index, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
422 |
out.put(index, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
423 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
424 |
for (int idx : bsms.bootstrap_arguments) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
425 |
value = slist.get(idx); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
426 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
427 |
value = visit(cfpool.get(idx), idx); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
428 |
debugln("[SG]: idx " + idx); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
429 |
debugln("[SG]: value " + value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
430 |
slist.set(idx, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
431 |
out.put(idx, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
432 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
433 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
434 |
} catch (InvalidIndex ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
435 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
436 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
437 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
438 |
return out; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
439 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
440 |
return new HashMap<>(0); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
441 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
442 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
443 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
444 |
public String visitClass(CONSTANT_Class_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
445 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
446 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
447 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
448 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
449 |
value = visit(cfpool.get(c.name_index), c.name_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
450 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
451 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
452 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
453 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
454 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
455 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
456 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
457 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
458 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
459 |
public String visitDouble(CONSTANT_Double_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
460 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
461 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
462 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
463 |
value = Double.toString(c.value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
464 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
465 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
466 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
467 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
468 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
469 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
470 |
public String visitFieldref(CONSTANT_Fieldref_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
471 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
472 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
473 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
474 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
475 |
value = visit(cfpool.get(c.class_index), c.class_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
476 |
value = value.concat(" " + visit(cfpool.get(c.name_and_type_index), |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
477 |
c.name_and_type_index)); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
478 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
479 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
480 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
481 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
482 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
483 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
484 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
485 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
486 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
487 |
public String visitFloat(CONSTANT_Float_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
488 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
489 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
490 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
491 |
value = Float.toString(c.value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
492 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
493 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
494 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
495 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
496 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
497 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
498 |
public String visitInteger(CONSTANT_Integer_info cnstnt, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
499 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
500 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
501 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
502 |
value = Integer.toString(cnstnt.value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
503 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
504 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
505 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
506 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
507 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
508 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
509 |
public String visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info c, |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
510 |
Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
511 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
512 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
513 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
514 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
515 |
value = visit(cfpool.get(c.class_index), c.class_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
516 |
value = value.concat(" " + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
517 |
visit(cfpool.get(c.name_and_type_index), |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
518 |
c.name_and_type_index)); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
519 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
520 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
521 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
522 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
523 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
524 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
525 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
526 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
527 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
528 |
public String visitInvokeDynamic(CONSTANT_InvokeDynamic_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
529 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
530 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
531 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
532 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
533 |
value = bsmMap.get(c.bootstrap_method_attr_index) + " " |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
534 |
+ visit(cfpool.get(c.name_and_type_index), c.name_and_type_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
535 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
536 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
537 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
538 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
539 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
540 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
541 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
542 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
543 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
544 |
public String visitLong(CONSTANT_Long_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
545 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
546 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
547 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
548 |
value = Long.toString(c.value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
549 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
550 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
551 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
552 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
553 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
554 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
555 |
public String visitNameAndType(CONSTANT_NameAndType_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
556 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
557 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
558 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
559 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
560 |
value = visit(cfpool.get(c.name_index), c.name_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
561 |
value = value.concat(" " + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
562 |
visit(cfpool.get(c.type_index), c.type_index)); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
563 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
564 |
} catch (InvalidIndex ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
565 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
566 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
567 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
568 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
569 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
570 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
571 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
572 |
public String visitMethodref(CONSTANT_Methodref_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
573 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
574 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
575 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
576 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
577 |
value = visit(cfpool.get(c.class_index), c.class_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
578 |
value = value.concat(" " + |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
579 |
visit(cfpool.get(c.name_and_type_index), |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
580 |
c.name_and_type_index)); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
581 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
582 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
583 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
584 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
585 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
586 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
587 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
588 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
589 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
590 |
public String visitMethodHandle(CONSTANT_MethodHandle_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
591 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
592 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
593 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
594 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
595 |
value = c.reference_kind.name(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
596 |
value = value.concat(" " |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
597 |
+ visit(cfpool.get(c.reference_index), c.reference_index)); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
598 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
599 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
600 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
601 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
602 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
603 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
604 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
605 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
606 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
607 |
public String visitMethodType(CONSTANT_MethodType_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
608 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
609 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
610 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
611 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
612 |
value = visit(cfpool.get(c.descriptor_index), c.descriptor_index); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
613 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
614 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
615 |
ex.printStackTrace(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
616 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
617 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
618 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
619 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
620 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
621 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
622 |
public String visitString(CONSTANT_String_info c, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
623 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
624 |
try { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
625 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
626 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
627 |
value = c.getString(); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
628 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
629 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
630 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
631 |
} catch (ConstantPoolException ex) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
632 |
throw new RuntimeException("Fatal error", ex); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
633 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
634 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
635 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
636 |
@Override |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
637 |
public String visitUtf8(CONSTANT_Utf8_info cnstnt, Integer p) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
638 |
|
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
639 |
String value = slist.get(p); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
640 |
if (value == null) { |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
641 |
value = cnstnt.value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
642 |
slist.set(p, value); |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
643 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
644 |
return value; |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
645 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
646 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
647 |
} |
1511efc930be
8011738: Write test to check for bootstrap attributes for lambda expressions in class file
sogoel
parents:
diff
changeset
|
648 |