diff -r 1f8c28134ffc -r 40adaf938847 src/share/classes/com/sun/tools/javac/code/Type.java --- a/src/share/classes/com/sun/tools/javac/code/Type.java Mon Mar 18 08:46:09 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java Mon Mar 18 14:40:32 2013 -0700 @@ -246,6 +246,10 @@ return this; } + public boolean isAnnotated() { + return false; + } + /** * If this is an annotated type, return the underlying type. * Otherwise, return the type itself. @@ -1539,7 +1543,12 @@ } public static class AnnotatedType extends Type - implements javax.lang.model.type.AnnotatedType { + implements + javax.lang.model.type.ArrayType, + javax.lang.model.type.DeclaredType, + javax.lang.model.type.PrimitiveType, + javax.lang.model.type.TypeVariable, + javax.lang.model.type.WildcardType { /** The type annotations on this type. */ public List typeAnnotations; @@ -1552,7 +1561,7 @@ super(underlyingType.tag, underlyingType.tsym); this.typeAnnotations = List.nil(); this.underlyingType = underlyingType; - Assert.check(underlyingType.getKind() != TypeKind.ANNOTATED, + Assert.check(!underlyingType.isAnnotated(), "Can't annotate already annotated type: " + underlyingType); } @@ -1561,14 +1570,19 @@ super(underlyingType.tag, underlyingType.tsym); this.typeAnnotations = typeAnnotations; this.underlyingType = underlyingType; - Assert.check(underlyingType.getKind() != TypeKind.ANNOTATED, + Assert.check(!underlyingType.isAnnotated(), "Can't annotate already annotated type: " + underlyingType + "; adding: " + typeAnnotations); } @Override + public boolean isAnnotated() { + return true; + } + + @Override public TypeKind getKind() { - return TypeKind.ANNOTATED; + return underlyingType.getKind(); } @Override @@ -1577,11 +1591,6 @@ } @Override - public TypeMirror getUnderlyingType() { - return underlyingType; - } - - @Override public Type unannotatedType() { return underlyingType; } @@ -1593,7 +1602,7 @@ @Override public R accept(TypeVisitor v, P p) { - return v.visitAnnotated(this, p); + return underlyingType.accept(v, p); } @Override