author | mcimadamore |
Mon, 31 Aug 2015 17:33:34 +0100 | |
changeset 32454 | b0ac04e0fefe |
parent 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
11143 | 1 |
/* |
30730
d3ce7619db2c
8076543: Add @modules as needed to the langtools tests
akulyakh
parents:
15384
diff
changeset
|
2 |
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
11143 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
26 |
* @bug 7115050 8003280 8005852 8006694 8129962 |
14547 | 27 |
* @summary Add lambda tests |
28 |
* Add parser support for lambda expressions |
|
15384
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15367
diff
changeset
|
29 |
* temporarily workaround combo tests are causing time out in several platforms |
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
30 |
* @library /tools/javac/lib |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
31 |
* @modules jdk.compiler/com.sun.tools.javac.api |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
32 |
* jdk.compiler/com.sun.tools.javac.code |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
33 |
* jdk.compiler/com.sun.tools.javac.comp |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
34 |
* jdk.compiler/com.sun.tools.javac.main |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
35 |
* jdk.compiler/com.sun.tools.javac.tree |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
36 |
* jdk.compiler/com.sun.tools.javac.util |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
37 |
* @build combo.ComboTestHelper |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
38 |
|
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
39 |
* @run main LambdaParserTest |
11143 | 40 |
*/ |
41 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
42 |
import java.io.IOException; |
15384
5a8d00abf076
8006694: temporarily workaround combo tests are causing time out in several platforms
vromero
parents:
15367
diff
changeset
|
43 |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
44 |
import combo.ComboInstance; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
45 |
import combo.ComboParameter; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
46 |
import combo.ComboTask.Result; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
47 |
import combo.ComboTestHelper; |
11143 | 48 |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
49 |
public class LambdaParserTest extends ComboInstance<LambdaParserTest> { |
11143 | 50 |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
51 |
enum LambdaKind implements ComboParameter { |
11143 | 52 |
NILARY_EXPR("()->x"), |
53 |
NILARY_STMT("()->{ return x; }"), |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
54 |
ONEARY_SHORT_EXPR("#{NAME}->x"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
55 |
ONEARY_SHORT_STMT("#{NAME}->{ return x; }"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
56 |
ONEARY_EXPR("(#{MOD[0]} #{TYPE[0]} #{NAME})->x"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
57 |
ONEARY_STMT("(#{MOD[0]} #{TYPE[0]} #{NAME})->{ return x; }"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
58 |
TWOARY_EXPR("(#{MOD[0]} #{TYPE[0]} #{NAME}, #{MOD[1]} #{TYPE[1]} y)->x"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
59 |
TWOARY_STMT("(#{MOD[0]} #{TYPE[0]} #{NAME}, #{MOD[1]} #{TYPE[1]} y)->{ return x; }"); |
11143 | 60 |
|
61 |
String lambdaTemplate; |
|
62 |
||
63 |
LambdaKind(String lambdaTemplate) { |
|
64 |
this.lambdaTemplate = lambdaTemplate; |
|
65 |
} |
|
66 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
67 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
68 |
public String expand(String optParameter) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
69 |
return lambdaTemplate; |
11143 | 70 |
} |
71 |
||
72 |
int arity() { |
|
73 |
switch (this) { |
|
74 |
case NILARY_EXPR: |
|
75 |
case NILARY_STMT: return 0; |
|
76 |
case ONEARY_SHORT_EXPR: |
|
77 |
case ONEARY_SHORT_STMT: |
|
78 |
case ONEARY_EXPR: |
|
79 |
case ONEARY_STMT: return 1; |
|
80 |
case TWOARY_EXPR: |
|
81 |
case TWOARY_STMT: return 2; |
|
82 |
default: throw new AssertionError("Invalid lambda kind " + this); |
|
83 |
} |
|
84 |
} |
|
85 |
||
86 |
boolean isShort() { |
|
87 |
return this == ONEARY_SHORT_EXPR || |
|
88 |
this == ONEARY_SHORT_STMT; |
|
89 |
} |
|
90 |
} |
|
91 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
92 |
enum LambdaParameterName implements ComboParameter { |
15367 | 93 |
IDENT("x"), |
94 |
UNDERSCORE("_"); |
|
95 |
||
96 |
String nameStr; |
|
97 |
||
98 |
LambdaParameterName(String nameStr) { |
|
99 |
this.nameStr = nameStr; |
|
100 |
} |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
101 |
|
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
102 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
103 |
public String expand(String optParameter) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
104 |
return nameStr; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
105 |
} |
15367 | 106 |
} |
107 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
108 |
enum LambdaParameterKind implements ComboParameter { |
11143 | 109 |
IMPLICIT(""), |
110 |
EXPLIICT_SIMPLE("A"), |
|
14725
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
111 |
EXPLIICT_SIMPLE_ARR1("A[]"), |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
112 |
EXPLIICT_SIMPLE_ARR2("A[][]"), |
11143 | 113 |
EXPLICIT_VARARGS("A..."), |
114 |
EXPLICIT_GENERIC1("A<X>"), |
|
14725
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
115 |
EXPLICIT_GENERIC2("A<? extends X, ? super Y>"), |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
116 |
EXPLICIT_GENERIC2_VARARGS("A<? extends X, ? super Y>..."), |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
117 |
EXPLICIT_GENERIC2_ARR1("A<? extends X, ? super Y>[]"), |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
118 |
EXPLICIT_GENERIC2_ARR2("A<? extends X, ? super Y>[][]"); |
11143 | 119 |
|
120 |
String parameterType; |
|
121 |
||
122 |
LambdaParameterKind(String parameterType) { |
|
123 |
this.parameterType = parameterType; |
|
124 |
} |
|
125 |
||
126 |
boolean explicit() { |
|
127 |
return this != IMPLICIT; |
|
128 |
} |
|
14725
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
129 |
|
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
130 |
boolean isVarargs() { |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
131 |
return this == EXPLICIT_VARARGS || |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
132 |
this == EXPLICIT_GENERIC2_VARARGS; |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
14547
diff
changeset
|
133 |
} |
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
134 |
|
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
135 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
136 |
public String expand(String optParameter) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
137 |
return parameterType; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
138 |
} |
11143 | 139 |
} |
140 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
141 |
enum ModifierKind implements ComboParameter { |
11143 | 142 |
NONE(""), |
143 |
FINAL("final"), |
|
144 |
PUBLIC("public"); |
|
145 |
||
146 |
String modifier; |
|
147 |
||
148 |
ModifierKind(String modifier) { |
|
149 |
this.modifier = modifier; |
|
150 |
} |
|
151 |
||
152 |
boolean compatibleWith(LambdaParameterKind pk) { |
|
153 |
switch (this) { |
|
154 |
case PUBLIC: return false; |
|
155 |
case FINAL: return pk != LambdaParameterKind.IMPLICIT; |
|
156 |
case NONE: return true; |
|
157 |
default: throw new AssertionError("Invalid modifier kind " + this); |
|
158 |
} |
|
159 |
} |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
160 |
|
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
161 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
162 |
public String expand(String optParameter) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
163 |
return modifier; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
164 |
} |
11143 | 165 |
} |
166 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
167 |
enum ExprKind implements ComboParameter { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
168 |
NONE("#{LAMBDA}#{SUBEXPR}"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
169 |
SINGLE_PAREN1("(#{LAMBDA}#{SUBEXPR})"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
170 |
SINGLE_PAREN2("(#{LAMBDA})#{SUBEXPR}"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
171 |
DOUBLE_PAREN1("((#{LAMBDA}#{SUBEXPR}))"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
172 |
DOUBLE_PAREN2("((#{LAMBDA})#{SUBEXPR})"), |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
173 |
DOUBLE_PAREN3("((#{LAMBDA}))#{SUBEXPR}"); |
11143 | 174 |
|
175 |
String expressionTemplate; |
|
176 |
||
177 |
ExprKind(String expressionTemplate) { |
|
178 |
this.expressionTemplate = expressionTemplate; |
|
179 |
} |
|
180 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
181 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
182 |
public String expand(String optParameter) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
183 |
return expressionTemplate; |
11143 | 184 |
} |
185 |
} |
|
186 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
187 |
enum SubExprKind implements ComboParameter { |
11143 | 188 |
NONE(""), |
189 |
SELECT_FIELD(".f"), |
|
190 |
SELECT_METHOD(".f()"), |
|
191 |
SELECT_NEW(".new Foo()"), |
|
192 |
POSTINC("++"), |
|
193 |
POSTDEC("--"); |
|
194 |
||
195 |
String subExpression; |
|
196 |
||
197 |
SubExprKind(String subExpression) { |
|
198 |
this.subExpression = subExpression; |
|
199 |
} |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
200 |
|
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
201 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
202 |
public String expand(String optParameter) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
203 |
return subExpression; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
204 |
} |
11143 | 205 |
} |
206 |
||
207 |
public static void main(String... args) throws Exception { |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
208 |
new ComboTestHelper<LambdaParserTest>() |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
209 |
.withFilter(LambdaParserTest::redundantTestFilter) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
210 |
.withFilter(LambdaParserTest::badImplicitFilter) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
211 |
.withDimension("LAMBDA", (x, lk) -> x.lk = lk, LambdaKind.values()) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
212 |
.withDimension("NAME", (x, name) -> x.pn = name, LambdaParameterName.values()) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
213 |
.withArrayDimension("TYPE", (x, type, idx) -> x.pks[idx] = type, 2, LambdaParameterKind.values()) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
214 |
.withArrayDimension("MOD", (x, mod, idx) -> x.mks[idx] = mod, 2, ModifierKind.values()) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
215 |
.withDimension("EXPR", ExprKind.values()) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
216 |
.withDimension("SUBEXPR", SubExprKind.values()) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
217 |
.run(LambdaParserTest::new); |
11143 | 218 |
} |
219 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
220 |
LambdaParameterKind[] pks = new LambdaParameterKind[2]; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
221 |
ModifierKind[] mks = new ModifierKind[2]; |
11143 | 222 |
LambdaKind lk; |
15367 | 223 |
LambdaParameterName pn; |
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
224 |
|
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
225 |
boolean badImplicitFilter() { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
226 |
return !(mks[0] != ModifierKind.NONE && lk.isShort()); |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
227 |
} |
11143 | 228 |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
229 |
boolean redundantTestFilter() { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
230 |
for (int i = lk.arity(); i < mks.length ; i++) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
231 |
if (mks[i].ordinal() != 0) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
232 |
return false; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
233 |
} |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
234 |
} |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
235 |
for (int i = lk.arity(); i < pks.length ; i++) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
236 |
if (pks[i].ordinal() != 0) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
237 |
return false; |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
238 |
} |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
239 |
} |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
240 |
return true; |
11143 | 241 |
} |
242 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
243 |
String template = "class Test {\n" + |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
244 |
" SAM s = #{EXPR};\n" + |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
245 |
"}"; |
11143 | 246 |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
247 |
@Override |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
248 |
public void doWork() throws IOException { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
249 |
check(newCompilationTask() |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
250 |
.withSourceFromTemplate(template) |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
251 |
.parse()); |
11143 | 252 |
} |
253 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
254 |
void check(Result<?> res) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
255 |
boolean errorExpected = (lk.arity() > 0 && !mks[0].compatibleWith(pks[0])) || |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
256 |
(lk.arity() > 1 && !mks[1].compatibleWith(pks[1])); |
11143 | 257 |
|
258 |
if (lk.arity() == 2 && |
|
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
259 |
(pks[0].explicit() != pks[1].explicit() || |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
260 |
pks[0].isVarargs())) { |
11143 | 261 |
errorExpected = true; |
262 |
} |
|
263 |
||
15367 | 264 |
errorExpected |= pn == LambdaParameterName.UNDERSCORE && |
265 |
lk.arity() > 0; |
|
266 |
||
32454
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
267 |
if (errorExpected != res.hasErrors()) { |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
268 |
fail("invalid diagnostics for source:\n" + |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
269 |
res.compilationInfo() + |
b0ac04e0fefe
8129962: Investigate performance improvements in langtools combo tests
mcimadamore
parents:
30730
diff
changeset
|
270 |
"\nFound error: " + res.hasErrors() + |
11143 | 271 |
"\nExpected error: " + errorExpected); |
272 |
} |
|
273 |
} |
|
274 |
} |