changeset 373:c9df2948e105

- javac: enrich class type param annotations reference_info - javap: recognize annotation positions
author mali
date Thu, 12 Mar 2009 23:42:13 -0400
parents 3a77abd877e1
children 45e6c5abee0a
files src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java src/share/classes/com/sun/tools/javac/comp/TransTypes.java
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Fri Feb 27 15:40:05 2009 -0500
+++ b/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Thu Mar 12 23:42:13 2009 -0400
@@ -164,7 +164,7 @@
                 loc = loc.append(cr.readUnsignedByte());
             position.location = loc.toList();
         }
-        return null;
+        return position;
     }
 
     private static int position_length(TypeAnnotations.Position pos) {
--- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Fri Feb 27 15:40:05 2009 -0500
+++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Mar 12 23:42:13 2009 -0400
@@ -849,7 +849,6 @@
             pop();
         }
 
-        @SuppressWarnings("deprecation")
         private TypeAnnotations.Position resolveContext(JCTree tree, JCTree context,
                 List<JCTree> path, TypeAnnotations.Position p) {
             switch (context.getKind()) {
@@ -935,9 +934,12 @@
                 case TYPE_PARAMETER:
 //                    System.out.print("type parameter: " +
 //                            ((JCTypeParameter)context).bounds.indexOf(tree) + " ");
-                    if (path.tail.tail.head.getTag() == JCTree.CLASSDEF)
+                    if (path.tail.tail.head.getTag() == JCTree.CLASSDEF) {
+                        JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
                         p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
-                    else if (path.tail.tail.head.getTag() == JCTree.METHODDEF) {
+                        p.parameter_index = clazz.typarams.indexOf(path.tail.head);
+                        p.bound_index = ((JCTypeParameter)context).bounds.indexOf(tree);                        
+                    } else if (path.tail.tail.head.getTag() == JCTree.METHODDEF) {
                         JCMethodDecl method = (JCMethodDecl)path.tail.tail.head;
                         p.type = TargetType.METHOD_TYPE_PARAMETER_BOUND;
                         p.parameter_index = method.typarams.indexOf(path.tail.head);