changeset 2266:152b6d2ea573

Correctly separate class/interface for anonymous classes.
author wmdietl
date Sun, 24 Feb 2013 16:35:32 -0800
parents d92cbf4c1699
children 443ada8123b3
files src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Sun Feb 24 16:34:39 2013 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Sun Feb 24 16:35:32 2013 -0800
@@ -1095,7 +1095,21 @@
                 TypeAnnotationPosition pos = new TypeAnnotationPosition();
                 pos.type = TargetType.CLASS_EXTENDS;
                 pos.pos = tree.pos;
-                separateAnnotationsKinds(classdecl, classdecl.sym.type, classdecl.sym, pos);
+                if (classdecl.extending == tree.clazz) {
+                    pos.type_index = -1;
+                } else if (classdecl.implementing.contains(tree.clazz)) {
+                    pos.type_index = classdecl.implementing.indexOf(tree.clazz);
+                } else {
+                    // In contrast to CLASS elsewhere, typarams cannot occur here.
+                    Assert.error("Could not determine position of tree " + tree);
+                }
+                Type before = classdecl.sym.type;
+                separateAnnotationsKinds(classdecl, tree.clazz.type, classdecl.sym, pos);
+
+                // classdecl.sym.type now contains an annotated type, which
+                // is not what we want there.
+                // TODO: should we put this type somewhere in the superclass/interface?
+                classdecl.sym.type = before;
             }
 
             scan(tree.encl);