// it works, and is lifted from existing code in 'Context.resolveName'
// and 'Context.getClassCommon'. See the comments there about the design.
// Fixes 4095716.
int ls = -2;
LocalMember lf = null;
if (classContext != null) {
lf = classContext.getLocalClass(name);
if (lf != null) {
ls = lf.getScopeNumber();
}
}
// Look for an unqualified name in enclosing scopes.
for (ClassDefinition c = this; c != null; c = c.outerClass) {
try {
MemberDefinition f = c.getInnerClass(env, name);
if (f != null &&
(lf == null || classContext.getScopeNumber(c) > ls)) {
// An uplevel member was found, and was nested more deeply than
// any enclosing local of the same name.
return f.getInnerClass().getName();
}
} catch (ClassNotFound ee) {
// a missing superclass, or something catastrophic
}
}
// No uplevel member found, so use the enclosing local if one was found.
if (lf != null) {
return lf.getInnerClass().getName();
}
// look in imports, etc.
return env.resolveName(name);
}