changeset 483:732510cc3538

6919986: [308] change size of type_index (of CLASS_EXTENDS and THROWS) from byte to short Reviewed-by: darcy, jjg Contributed-by: mali@csail.mit.edu, mernst@cs.washington.edu
author jjg
date Mon, 01 Feb 2010 17:05:35 -0800
parents 8e638442522a
children b0a68258360a
files src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
diffstat 4 files changed, 12 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Fri Jan 29 16:54:52 2010 -0800
+++ b/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java	Mon Feb 01 17:05:35 2010 -0800
@@ -123,11 +123,14 @@
          // Class extends and implements clauses
         case CLASS_EXTENDS:
         case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            position.type_index = cr.readUnsignedByte();
+            int in = cr.readUnsignedShort();
+            if (in == 0xFFFF)
+                in = -1;
+            position.type_index = in;
             break;
         // throws
         case THROWS:
-            position.type_index = cr.readUnsignedByte();
+            position.type_index = cr.readUnsignedShort();
             break;
         case CLASS_LITERAL:
         case CLASS_LITERAL_GENERIC_OR_ARRAY:
@@ -213,11 +216,11 @@
          // Class extends and implements clauses
         case CLASS_EXTENDS:
         case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            n += 1; // type_index
+            n += 2; // type_index
             break;
         // throws
         case THROWS:
-            n += 1; // type_index
+            n += 2; // type_index
             break;
         case CLASS_LITERAL:
         case CLASS_LITERAL_GENERIC_OR_ARRAY:
--- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Fri Jan 29 16:54:52 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java	Mon Feb 01 17:05:35 2010 -0800
@@ -149,11 +149,7 @@
                     JCFieldAccess fieldFrame = (JCFieldAccess)frame;
                     if ("class".contentEquals(fieldFrame.name)) {
                         p.type = TargetType.CLASS_LITERAL;
-                        if (fieldFrame.selected instanceof JCAnnotatedType) {
-                            p.pos = TreeInfo.typeIn(fieldFrame).pos;
-                        } else if (fieldFrame.selected instanceof JCArrayTypeTree) {
-                            p.pos = fieldFrame.selected.pos;
-                        }
+                        p.pos = TreeInfo.innermostType(fieldFrame.selected).pos;
                     } else
                         throw new AssertionError();
                     return p;
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Jan 29 16:54:52 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Feb 01 17:05:35 2010 -0800
@@ -1425,11 +1425,11 @@
          // Class extends and implements clauses
         case CLASS_EXTENDS:
         case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            position.type_index = nextByte();
+            position.type_index = nextChar();
             break;
         // throws
         case THROWS:
-            position.type_index = nextByte();
+            position.type_index = nextChar();
             break;
         case CLASS_LITERAL:
         case CLASS_LITERAL_GENERIC_OR_ARRAY:
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Jan 29 16:54:52 2010 -0800
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Mon Feb 01 17:05:35 2010 -0800
@@ -965,11 +965,11 @@
          // Class extends and implements clauses
         case CLASS_EXTENDS:
         case CLASS_EXTENDS_GENERIC_OR_ARRAY:
-            databuf.appendByte(p.type_index);
+            databuf.appendChar(p.type_index);
             break;
         // throws
         case THROWS:
-            databuf.appendByte(p.type_index);
+            databuf.appendChar(p.type_index);
             break;
         case CLASS_LITERAL:
         case CLASS_LITERAL_GENERIC_OR_ARRAY: