diff -r c896d95e7469 -r ec59a2ce9114 src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Nov 24 13:36:20 2011 +0000 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Thu Nov 24 13:38:40 2011 +0000 @@ -227,6 +227,34 @@ } } + /** + * Return true if the AST corresponds to a static select of the kind A.B + */ + public static boolean isStaticSelector(JCTree base, Names names) { + if (base == null) + return false; + switch (base.getTag()) { + case IDENT: + JCIdent id = (JCIdent)base; + return id.name != names._this && + id.name != names._super && + isStaticSym(base); + case SELECT: + return isStaticSym(base) && + isStaticSelector(((JCFieldAccess)base).selected, names); + case TYPEAPPLY: + return true; + default: + return false; + } + } + //where + private static boolean isStaticSym(JCTree tree) { + Symbol sym = symbol(tree); + return (sym.kind == Kinds.TYP || + sym.kind == Kinds.PCK); + } + /** Return true if a tree represents the null literal. */ public static boolean isNull(JCTree tree) { if (!tree.hasTag(LITERAL))