--- old/src/share/classes/com/sun/tools/javac/code/Symbol.java 2013-03-28 19:00:15.000000000 -0700 +++ new/src/share/classes/com/sun/tools/javac/code/Symbol.java 2013-03-28 19:00:15.000000000 -0700 @@ -466,7 +466,7 @@ * This is the implementation for {@code * javax.lang.model.element.Element.getAnnotationMirrors()}. */ - public final List getAnnotationMirrors() { + public List getAnnotationMirrors() { return getRawAttributes(); } @@ -474,7 +474,7 @@ * TODO: Should there be a {@code * javax.lang.model.element.Element.getTypeAnnotationMirrors()}. */ - public final List getTypeAnnotationMirrors() { + public List getTypeAnnotationMirrors() { return getRawTypeAttributes(); } @@ -658,6 +658,22 @@ return ct.interfaces_field; } } + + @Override + public List getAnnotationMirrors() { + return onlyTypeParameterAnnos(owner.getRawTypeAttributes()); + } + + private List onlyTypeParameterAnnos(List candidates) { + // Declaration annotations on TypeParameters are stored in type attributes + List res = List.nil(); + for (Attribute.TypeCompound a : candidates) + if (a.position.type == TargetType.CLASS_TYPE_PARAMETER || + a.position.type == TargetType.METHOD_TYPE_PARAMETER) + res = res.prepend(a); + + return res = res.reverse(); + } } /** A class for package symbols