8193142: Regression: ClassCastException: Type$ErrorType cannot be cast to Type$ArrayType
Reviewed-by: mcimadamore
--- 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