8007546: ClassCastException on JSR308 tests

8015993: jck-compiler tests are failed with java.lang.ClassCastException

Fix ClassCastExceptions arising from addition of AnnotatedType.

Reviewed-by: jjg, abuckley
This commit is contained in:
Eric McCorkle 2013-06-20 19:01:20 -04:00
parent 1a284a49c9
commit bca53c33de
2 changed files with 9 additions and 5 deletions

View File

@ -3206,7 +3206,7 @@ public class Attr extends JCTree.Visitor {
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);

View File

@ -919,11 +919,15 @@ public class Code {
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 UniqueType) return typeForPool(((UniqueType)o).type);
if (o instanceof Pool.MethodHandle) return syms.methodHandleType;
throw new AssertionError(o);
if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type);
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;