aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/share/classes/com/sun/tools/javac/comp/Attr.java5
-rw-r--r--test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java10
-rw-r--r--test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out2
3 files changed, 14 insertions, 3 deletions
diff --git a/src/share/classes/com/sun/tools/javac/comp/Attr.java b/src/share/classes/com/sun/tools/javac/comp/Attr.java
index bb7f1a5f..822dbb6f 100644
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -4602,9 +4602,8 @@ public class Attr extends JCTree.Visitor {
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() +
diff --git a/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java
new file mode 100644
index 00000000..366c5d81
--- /dev/null
+++ b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java
@@ -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) {}
+}
diff --git a/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out
new file mode 100644
index 00000000..cb8fea40
--- /dev/null
+++ b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out
@@ -0,0 +1,2 @@
+TypeAnnotationsCrashWithErroneousTreeTest.java:9:20: compiler.err.illegal.start.of.type
+1 error