diff -r d94fe2d29b1e -r 380f6c17ea01 src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Jun 10 09:13:27 2015 +0200 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Jan 10 12:47:15 2014 +0100 @@ -28,6 +28,7 @@ import com.sun.source.tree.Tree; +import com.sun.source.util.TreePath; import com.sun.tools.javac.code.*; import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Env; @@ -351,6 +352,18 @@ return (lit.typetag == BOT); } + /** Return true iff this tree is a child of some annotation. */ + public static boolean isInAnnotation(Env env, JCTree tree) { + TreePath tp = TreePath.getPath(env.toplevel, tree); + if (tp != null) { + for (Tree t : tp) { + if (t.getKind() == Tree.Kind.ANNOTATION) + return true; + } + } + return false; + } + public static String getCommentText(Env env, JCTree tree) { DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL)) ? ((JCCompilationUnit) tree).docComments