8026963: type annotations code crashes for code with erroneous trees
Reviewed-by: jjg, jlahoda
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Nov 14 12:32:57 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Nov 14 19:28:20 2013 +0000
@@ -4602,9 +4602,8 @@
validateAnnotatedType(t, t.type);
}
repeat = false;
- } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE) {
- // This happens in test TargetTypeTest52.java
- // Is there anything to do?
+ } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE ||
+ enclTr.getKind() == JCTree.Kind.ERRONEOUS) {
repeat = false;
} else {
Assert.error("Unexpected tree: " + enclTr + " with kind: " + enclTr.getKind() +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java Thu Nov 14 19:28:20 2013 +0000
@@ -0,0 +1,10 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8026963
+ * @summary type annotations code crashes for lambdas with void argument
+ * @compile/fail/ref=TypeAnnotationsCrashWithErroneousTreeTest.out -XDrawDiagnostics -XDshouldStopPolicy=FLOW TypeAnnotationsCrashWithErroneousTreeTest.java
+ */
+
+public class TypeAnnotationsCrashWithErroneousTreeTest {
+ private void t(this) {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out Thu Nov 14 19:28:20 2013 +0000
@@ -0,0 +1,2 @@
+TypeAnnotationsCrashWithErroneousTreeTest.java:9:20: compiler.err.illegal.start.of.type
+1 error