8193142: Regression: ClassCastException: Type$ErrorType cannot be cast to Type$ArrayType
authorsadayapalam
Tue, 12 Dec 2017 18:40:31 +0530
changeset 48246 aadc02050d3b
parent 48245 be39de5f0315
child 48247 fa5a47cad0c9
8193142: Regression: ClassCastException: Type$ErrorType cannot be cast to Type$ArrayType Reviewed-by: mcimadamore
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
test/langtools/tools/javac/varargs/ElementTypeMissingTest.java
test/langtools/tools/javac/varargs/ElementTypeMissingTest.out
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Dec 12 13:08:22 2017 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Dec 12 18:40:31 2017 +0530
@@ -4238,9 +4238,6 @@
     public void visitTypeArray(JCArrayTypeTree tree) {
         Type etype = attribType(tree.elemtype, env);
         Type type = new ArrayType(etype, syms.arrayClass);
-        if (etype.isErroneous()) {
-            type = types.createErrorType(type);
-        }
         result = check(tree, type, KindSelector.TYP, resultInfo);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/varargs/ElementTypeMissingTest.java	Tue Dec 12 18:40:31 2017 +0530
@@ -0,0 +1,8 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8193142
+ * @summary Regression: ClassCastException: Type$ErrorType cannot be cast to Type$ArrayType
+ * @compile/fail/ref=ElementTypeMissingTest.out -XDrawDiagnostics -XDdev ElementTypeMissingTest.java
+ */
+
+public class ElementTypeMissingTest { void m(Unkn... own) { } }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/varargs/ElementTypeMissingTest.out	Tue Dec 12 18:40:31 2017 +0530
@@ -0,0 +1,2 @@
+ElementTypeMissingTest.java:8:46: compiler.err.cant.resolve.location: kindname.class, Unkn, , , (compiler.misc.location: kindname.class, ElementTypeMissingTest, null)
+1 error
\ No newline at end of file