8257236: can't use var with a class named Z
Reviewed-by: sundar
This commit is contained in:
parent
2243a1703b
commit
77ca1031a0
@ -107,11 +107,16 @@ abstract class Wrap implements GeneralWrap {
|
||||
// }
|
||||
// in do_it method:
|
||||
//return do_itAux();
|
||||
//find an unused name:
|
||||
String scratchName = "$";
|
||||
while (winit.wrapped().contains(scratchName)) {
|
||||
scratchName += "$";
|
||||
}
|
||||
Wrap waux = new CompoundWrap(
|
||||
" private static <Z> Z ", DOIT_METHOD_NAME + "Aux", "() throws Throwable {\n",
|
||||
wtype, brackets + " ", wname, "_ =\n ", winit, semi(winit),
|
||||
" @SuppressWarnings(\"unchecked\") Z ", wname, "__ = (Z)", wname, "_;\n",
|
||||
" return ", wname, "__;\n",
|
||||
" private static <" + scratchName + "> " + scratchName +" ", DOIT_METHOD_NAME + "Aux", "() throws Throwable {\n",
|
||||
wtype, brackets + " ", scratchName, "_ =\n ", winit, semi(winit),
|
||||
" @SuppressWarnings(\"unchecked\") ", scratchName, " ", scratchName, "__ = (", scratchName, ")", scratchName, "_;\n",
|
||||
" return ", scratchName, "__;\n",
|
||||
"}"
|
||||
);
|
||||
components.add(waux);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8144903 8177466 8191842 8211694 8213725 8239536
|
||||
* @bug 8144903 8177466 8191842 8211694 8213725 8239536 8257236
|
||||
* @summary Tests for EvaluationState.variables
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
@ -400,6 +400,13 @@ public class VariablesTest extends KullaTesting {
|
||||
assertEval("r15a.add(\"a\");");
|
||||
assertEval("var r15b = r15a.get(0);");
|
||||
assertEval("r15b", "\"a\"");
|
||||
assertEval("class Z { }");
|
||||
assertEval("var r16a = new Z();");
|
||||
assertEval("var r16b = (Runnable) () -> {int r16b_; int r16b__;};");
|
||||
assertEval("class $ { }");
|
||||
assertEval("var r16c = new $();");
|
||||
assertEval("$ r16d() { return null; }");
|
||||
assertEval("var r16d = r16d();");
|
||||
}
|
||||
|
||||
public void test8191842() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user