1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Tue Feb 12 19:25:09 2013 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Tue Feb 12 17:15:29 2013 -0800 1.3 @@ -2068,7 +2068,15 @@ 1.4 1.5 @Override 1.6 public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) { 1.7 - return new AnnotatedType(t.typeAnnotations, erasure(t.underlyingType, recurse)); 1.8 + Type erased = erasure(t.underlyingType, recurse); 1.9 + if (erased.getKind() == TypeKind.ANNOTATED) { 1.10 + // This can only happen when the underlying type is a 1.11 + // type variable and the upper bound of it is annotated. 1.12 + // The annotation on the type variable overrides the one 1.13 + // on the bound. 1.14 + erased = ((AnnotatedType)erased).underlyingType; 1.15 + } 1.16 + return new AnnotatedType(t.typeAnnotations, erased); 1.17 } 1.18 }; 1.19