src/share/classes/com/sun/tools/javac/comp/Resolve.java
Print this page
@@ -1850,19 +1850,21 @@
*/
Symbol findType(Env<AttrContext> env, Name name) {
Symbol bestSoFar = typeNotFound;
Symbol sym;
boolean staticOnly = false;
+ Symbol staticError = null;
for (Env<AttrContext> env1 = env; env1.outer != null; env1 = env1.outer) {
if (isStatic(env1)) staticOnly = true;
for (Scope.Entry e = env1.info.scope.lookup(name);
e.scope != null;
e = e.next()) {
if (e.sym.kind == TYP) {
if (staticOnly &&
e.sym.type.hasTag(TYPEVAR) &&
- e.sym.owner.kind == TYP) return new StaticError(e.sym);
+ e.sym.owner.kind == TYP) staticError = e.sym;
+ else
return e.sym;
}
}
sym = findMemberType(env1, env1.enclClass.sym.type, name,
@@ -1878,10 +1880,12 @@
JCClassDecl encl = env1.baseClause ? (JCClassDecl)env1.tree : env1.enclClass;
if ((encl.sym.flags() & STATIC) != 0)
staticOnly = true;
}
+ if (staticError != null)
+ return new StaticError(staticError);
if (!env.tree.hasTag(IMPORT)) {
sym = findGlobalType(env, env.toplevel.namedImportScope, name);
if (sym.exists()) return sym;
else if (sym.kind < bestSoFar.kind) bestSoFar = sym;