changeset 406:926140ad88bc

bug fixes for targettype and related to: - new_type_argument - class_literal_generic_or_array
author mali
date Thu, 26 Mar 2009 16:49:28 -0400
parents 19ffb3fcb045
children 4d364b408827
files src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java src/share/classes/com/sun/tools/javac/comp/TargetType.java src/share/classes/com/sun/tools/javac/comp/TransTypes.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
diffstat 5 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Tue Mar 24 23:30:58 2009 -0400
+++ b/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Thu Mar 26 16:49:28 2009 -0400
@@ -79,8 +79,6 @@
         // new expression
         case NEW:
         case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             position.offset = cr.readUnsignedShort();
             break;
          // local variable
@@ -125,6 +123,7 @@
             position.type_index = cr.readUnsignedByte();
             break;
         case CLASS_LITERAL:
+        case CLASS_LITERAL_GENERIC_OR_ARRAY:
             position.offset = cr.readUnsignedShort();
             break;
         // method parameter: not specified
@@ -132,6 +131,8 @@
             position.parameter_index = cr.readUnsignedByte();
             break;
         // method type argument: wasn't specified
+        case NEW_TYPE_ARGUMENT:
+        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
         case METHOD_TYPE_ARGUMENT:
         case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             position.offset = cr.readUnsignedShort();
@@ -180,8 +181,6 @@
         // new expression
         case NEW:
         case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             n += 2;
             break;
          // local variable
@@ -224,6 +223,7 @@
             n += 1; // type_index
             break;
         case CLASS_LITERAL:
+        case CLASS_LITERAL_GENERIC_OR_ARRAY:
             n += 1; // offset
             break;
         // method parameter: not specified
@@ -231,6 +231,8 @@
             n += 1; // parameter_index
             break;
         // method type argument: wasn't specified
+        case NEW_TYPE_ARGUMENT:
+        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
         case METHOD_TYPE_ARGUMENT:
         case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             n += 2; // offset
--- a/src/share/classes/com/sun/tools/javac/comp/TargetType.java	Tue Mar 24 23:30:58 2009 -0400
+++ b/src/share/classes/com/sun/tools/javac/comp/TargetType.java	Thu Mar 26 16:49:28 2009 -0400
@@ -220,7 +220,7 @@
         if (targets == null)
             targets = buildTargets();
 
-        if (tag == UNKNOWN.targetTypeValue)
+        if (((byte)tag) == ((byte)UNKNOWN.targetTypeValue))
             return UNKNOWN;
         // we can optimize the algorithm a bit: binary search?
         if (tag < 0 || tag >= targets.length)
--- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue Mar 24 23:30:58 2009 -0400
+++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Mar 26 16:49:28 2009 -0400
@@ -942,7 +942,7 @@
                         JCClassDecl clazz = (JCClassDecl)path.tail.tail.head;
                         p.type = TargetType.CLASS_TYPE_PARAMETER_BOUND;
                         p.parameter_index = clazz.typarams.indexOf(path.tail.head);
-                        p.bound_index = ((JCTypeParameter)context).bounds.indexOf(tree);                        
+                        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;
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Mar 24 23:30:58 2009 -0400
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Mar 26 16:49:28 2009 -0400
@@ -1220,8 +1220,6 @@
         // new expression
         case NEW:
         case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             position.offset = nextChar();
             break;
          // local variable
@@ -1266,6 +1264,7 @@
             position.type_index = nextByte();
             break;
         case CLASS_LITERAL:
+        case CLASS_LITERAL_GENERIC_OR_ARRAY:
             position.offset = nextChar();
             break;
         // method parameter: not specified
@@ -1273,6 +1272,8 @@
             position.parameter_index = nextByte();
             break;
         // method type argument: wasn't specified
+        case NEW_TYPE_ARGUMENT:
+        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
         case METHOD_TYPE_ARGUMENT:
         case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             position.offset = nextChar();
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Tue Mar 24 23:30:58 2009 -0400
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Mar 26 16:49:28 2009 -0400
@@ -929,8 +929,6 @@
         // new expression
         case NEW:
         case NEW_GENERIC_OR_ARRAY:
-        case NEW_TYPE_ARGUMENT:
-        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             databuf.appendChar(p.offset);
             break;
          // local variable
@@ -974,6 +972,7 @@
             databuf.appendByte(p.type_index);
             break;
         case CLASS_LITERAL:
+        case CLASS_LITERAL_GENERIC_OR_ARRAY:
             databuf.appendChar(p.offset);
             break;
         // method parameter: not specified
@@ -981,6 +980,8 @@
             databuf.appendByte(p.parameter_index);
             break;
         // method type argument: wasn't specified
+        case NEW_TYPE_ARGUMENT:
+        case NEW_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
         case METHOD_TYPE_ARGUMENT:
         case METHOD_TYPE_ARGUMENT_GENERIC_OR_ARRAY:
             databuf.appendChar(p.offset);