changeset 1850:e9ebff1840e5

8007546: ClassCastException on JSR308 tests 8015993: jck-compiler tests are failed with java.lang.ClassCastException Summary: Fix ClassCastExceptions arising from addition of AnnotatedType. Reviewed-by: jjg, abuckley
author emc
date Thu, 20 Jun 2013 19:01:20 -0400
parents 6debfa63a4a1
children bf020de5a6db
files src/share/classes/com/sun/tools/javac/comp/Attr.java src/share/classes/com/sun/tools/javac/jvm/Code.java
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 20 08:45:43 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 20 19:01:20 2013 -0400
@@ -3206,7 +3206,7 @@
         if (skind == TYP) {
             Type elt = site;
             while (elt.hasTag(ARRAY))
-                elt = ((ArrayType)elt).elemtype;
+                elt = ((ArrayType)elt.unannotatedType()).elemtype;
             if (elt.hasTag(TYPEVAR)) {
                 log.error(tree.pos(), "type.var.cant.be.deref");
                 result = types.createErrorType(tree.type);
--- a/src/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Jun 20 08:45:43 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/jvm/Code.java	Thu Jun 20 19:01:20 2013 -0400
@@ -919,11 +919,15 @@
         if (o instanceof Long) return syms.longType;
         if (o instanceof Double) return syms.doubleType;
         if (o instanceof ClassSymbol) return syms.classType;
-        if (o instanceof Type.ArrayType) return syms.classType;
-        if (o instanceof Type.MethodType) return syms.methodTypeType;
+        if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
         if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
-        if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
-        throw new AssertionError(o);
+        if (o instanceof Type) {
+            Type ty = ((Type)o).unannotatedType();
+
+            if (ty instanceof Type.ArrayType) return syms.classType;
+            if (ty instanceof Type.MethodType) return syms.methodTypeType;
+        }
+        throw new AssertionError("Invalid type of constant pool entry: " + o.getClass());
     }
 
     /** Emit an opcode with a one-byte operand field;