8057685: javac should not crash compiling type annotations
authorsadayapalam
Fri, 23 Oct 2015 08:21:41 +0530
changeset 33370 f563e436a81f
parent 33369 e0404c48dca7
child 33371 b6f6281b4c07
child 33910 fed7dd476f90
8057685: javac should not crash compiling type annotations Reviewed-by: jlahoda
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java
langtools/test/tools/javac/annotations/typeAnnotations/newlocations/AllLocations.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Oct 22 11:12:55 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Fri Oct 23 08:21:41 2015 +0530
@@ -356,7 +356,7 @@
 
             if (sym.getKind() == ElementKind.METHOD) {
                 sym.type.asMethodType().restype = type;
-            } else if (sym.getKind() == ElementKind.PARAMETER) {
+            } else if (sym.getKind() == ElementKind.PARAMETER && currentLambda == null) {
                 sym.type = type;
                 if (sym.getQualifiedName().equals(names._this)) {
                     sym.owner.type.asMethodType().recvtype = type;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Oct 22 11:12:55 2015 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Fri Oct 23 08:21:41 2015 +0530
@@ -1117,11 +1117,11 @@
 
         @Override
         public void visitNewClass(JCNewClass tree) {
-            if (tree.def == null) {
-                // For an anonymous class instantiation the class
-                // will be visited separately.
-                super.visitNewClass(tree);
-            }
+            scan(tree.encl);
+            scan(tree.typeargs);
+            scan(tree.clazz);
+            scan(tree.args);
+            // the anonymous class instantiation if any will be visited separately.
         }
     }
 
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/AllLocations.java	Thu Oct 22 11:12:55 2015 -0700
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/AllLocations.java	Fri Oct 23 08:21:41 2015 +0530
@@ -25,7 +25,6 @@
  * @test
  * @bug 8027262
  * @summary Stress test for type annotatons
- * @ignore 8057685 javac should not crash compiling type annotations
  * @compile AllLocations.java
  */