From 378a8861c0436e05c354fa0b1ee9688b8bb48abc Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Mon, 1 Feb 2010 17:05:35 -0800 Subject: [PATCH] 6919986: [308] change size of type_index (of CLASS_EXTENDS and THROWS) from byte to short Co-authored-by: Michael Ernst Reviewed-by: darcy, jjg --- .../com/sun/tools/classfile/ExtendedAnnotation.java | 11 +++++++---- .../com/sun/tools/javac/code/TypeAnnotations.java | 6 +----- .../classes/com/sun/tools/javac/jvm/ClassReader.java | 4 ++-- .../classes/com/sun/tools/javac/jvm/ClassWriter.java | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java b/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java index 756870e664f..2072ae648b0 100644 --- a/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java +++ b/langtools/src/share/classes/com/sun/tools/classfile/ExtendedAnnotation.java @@ -123,11 +123,14 @@ public class ExtendedAnnotation { // 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 @@ public class ExtendedAnnotation { // 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: diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index 90943e9bb41..b3e45fe8dbd 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -149,11 +149,7 @@ public class TypeAnnotations { 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; diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java index 146c7100ea9..cedbf235681 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -1425,11 +1425,11 @@ public class ClassReader implements Completer { // 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: diff --git a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java index 2ed523802ff..39f73bf4de5 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java @@ -965,11 +965,11 @@ public class ClassWriter extends ClassFile { // 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: