3213 protected Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) { |
3213 protected Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) { |
3214 Symbol sym = needsInference ? |
3214 Symbol sym = needsInference ? |
3215 findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) : |
3215 findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()) : |
3216 findMethod(env, site, name, argtypes, typeargtypes, |
3216 findMethod(env, site, name, argtypes, typeargtypes, |
3217 phase.isBoxingRequired(), phase.isVarargsRequired()); |
3217 phase.isBoxingRequired(), phase.isVarargsRequired()); |
3218 return site.getEnclosingType().hasTag(CLASS) && !hasEnclosingInstance(env, site) ? |
3218 return enclosingInstanceMissing(env, site) ? new BadConstructorReferenceError(sym) : sym; |
3219 new BadConstructorReferenceError(sym) : sym; |
|
3220 } |
3219 } |
3221 |
3220 |
3222 @Override |
3221 @Override |
3223 ReferenceKind referenceKind(Symbol sym) { |
3222 ReferenceKind referenceKind(Symbol sym) { |
3224 return site.getEnclosingType().hasTag(NONE) ? |
3223 return site.getEnclosingType().hasTag(NONE) ? |
3347 } else { |
3346 } else { |
3348 return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true); |
3347 return accessBase(sym, pos, env.enclClass.sym.type, sym.name, true); |
3349 } |
3348 } |
3350 } |
3349 } |
3351 |
3350 |
3352 boolean hasEnclosingInstance(Env<AttrContext> env, Type type) { |
3351 boolean enclosingInstanceMissing(Env<AttrContext> env, Type type) { |
3353 Symbol encl = resolveSelfContainingInternal(env, type.tsym, false); |
3352 if (type.hasTag(CLASS) && type.getEnclosingType().hasTag(CLASS)) { |
3354 return encl != null && !encl.kind.isResolutionError(); |
3353 Symbol encl = resolveSelfContainingInternal(env, type.tsym, false); |
|
3354 return encl == null || encl.kind.isResolutionError(); |
|
3355 } |
|
3356 return false; |
3355 } |
3357 } |
3356 |
3358 |
3357 private Symbol resolveSelfContainingInternal(Env<AttrContext> env, |
3359 private Symbol resolveSelfContainingInternal(Env<AttrContext> env, |
3358 Symbol member, |
3360 Symbol member, |
3359 boolean isSuperCall) { |
3361 boolean isSuperCall) { |