diff -r 664edca41e34 -r 7c154fdc3547 src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java --- a/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java Fri Jun 26 19:12:41 2009 -0700 +++ b/src/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java Fri Jun 26 19:47:12 2009 -0700 @@ -45,6 +45,7 @@ public int pos = -1; // For typecasts, type tests, new (and locals, as start_pc). + public boolean isValidOffset = false; public int offset = -1; // For locals. arrays same length @@ -177,4 +178,17 @@ sb.append(']'); return sb.toString(); } + + /** + * Indicates whether the target tree of the annotation has been optimized + * away from classfile or not. + * @return true if the target has not been optimized away + */ + public boolean emitToClassfile() { + if (type == TargetType.WILDCARD_BOUND + || type == TargetType.WILDCARD_BOUND_GENERIC_OR_ARRAY) + return wildcard_position.isValidOffset; + else + return !type.isLocal() || isValidOffset; + } }