Thu, 14 Nov 2013 19:28:20 +0000
8026963: type annotations code crashes for code with erroneous trees
Reviewed-by: jjg, jlahoda
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Nov 14 12:32:57 2013 -0500 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Nov 14 19:28:20 2013 +0000 1.3 @@ -4602,9 +4602,8 @@ 1.4 validateAnnotatedType(t, t.type); 1.5 } 1.6 repeat = false; 1.7 - } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE) { 1.8 - // This happens in test TargetTypeTest52.java 1.9 - // Is there anything to do? 1.10 + } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE || 1.11 + enclTr.getKind() == JCTree.Kind.ERRONEOUS) { 1.12 repeat = false; 1.13 } else { 1.14 Assert.error("Unexpected tree: " + enclTr + " with kind: " + enclTr.getKind() +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.java Thu Nov 14 19:28:20 2013 +0000 2.3 @@ -0,0 +1,10 @@ 2.4 +/* 2.5 + * @test /nodynamiccopyright/ 2.6 + * @bug 8026963 2.7 + * @summary type annotations code crashes for lambdas with void argument 2.8 + * @compile/fail/ref=TypeAnnotationsCrashWithErroneousTreeTest.out -XDrawDiagnostics -XDshouldStopPolicy=FLOW TypeAnnotationsCrashWithErroneousTreeTest.java 2.9 + */ 2.10 + 2.11 +public class TypeAnnotationsCrashWithErroneousTreeTest { 2.12 + private void t(this) {} 2.13 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/T8026963/TypeAnnotationsCrashWithErroneousTreeTest.out Thu Nov 14 19:28:20 2013 +0000 3.3 @@ -0,0 +1,2 @@ 3.4 +TypeAnnotationsCrashWithErroneousTreeTest.java:9:20: compiler.err.illegal.start.of.type 3.5 +1 error