changeset 2270:8ac9188d174b

Set type_index for casts that are not on an intersection type to zero.
author wmdietl
date Mon, 25 Feb 2013 17:09:30 -0800
parents 98f69da5024e
children 9ec2520c8016
files src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Sun Feb 24 20:09:20 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Mon Feb 25 17:09:30 2013 -0800
@@ -594,7 +594,13 @@
 
             switch (frame.getKind()) {
                 case TYPE_CAST:
+                    JCTypeCast frameTC = (JCTypeCast) frame;
                     p.type = TargetType.CAST;
+                    if (frameTC.clazz.hasTag(Tag.TYPEINTERSECTION)) {
+                        // This case was already handled by INTERSECTION_TYPE
+                    } else {
+                        p.type_index = 0;
+                    }
                     p.pos = frame.pos;
                     return;
 
@@ -604,7 +610,7 @@
                     return;
 
                 case NEW_CLASS:
-                    JCNewClass frameNewClass = (JCNewClass)frame;
+                    JCNewClass frameNewClass = (JCNewClass) frame;
                     if (frameNewClass.def != null) {
                         // Special handling for anonymous class instantiations
                         JCClassDecl frameClassDecl = frameNewClass.def;
@@ -1172,8 +1178,8 @@
             if (!annotations.isEmpty()) {
                 /*
                 System.out.println("Finding pos for: " + annotations);
-                System.out.println("    tree: " + tree);
-                System.out.println("    frame: " + frame);
+                System.out.println("    tree: " + tree + " kind: " + tree.getKind());
+                System.out.println("    frame: " + frame + " kind: " + frame.getKind());
                 */
                 TypeAnnotationPosition p = new TypeAnnotationPosition();
                 resolveFrame(tree, frame, frames.toList(), p);