changeset 3070:b3ed4ac7cd91

8057685: javac should not crash compiling type annotations Reviewed-by: jlahoda
author sadayapalam
date Fri, 23 Oct 2015 08:21:41 +0530
parents b3f440e93b97
children 16873e56156e 91ea64d22fd9
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java test/tools/javac/annotations/typeAnnotations/newlocations/AllLocations.java
diffstat 3 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Thu Oct 22 11:12:55 2015 -0700
+++ b/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/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Oct 22 11:12:55 2015 -0700
+++ b/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/test/tools/javac/annotations/typeAnnotations/newlocations/AllLocations.java	Thu Oct 22 11:12:55 2015 -0700
+++ b/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
  */