src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 2193
d4cbb671de1c
parent 2191
e79d6425f1c4
child 2200
7c89d200781b
equal deleted inserted replaced
2192:5ae66d372d57 2193:d4cbb671de1c
2695 } 2695 }
2696 2696
2697 Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null; 2697 Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null;
2698 List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save(); 2698 List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save();
2699 try { 2699 try {
2700 refResult = rs.resolveMemberReference(that.pos(), localEnv, that, that.expr.type, 2700 refResult = rs.resolveMemberReference(localEnv, that, that.expr.type,
2701 that.name, argtypes, typeargtypes, true, referenceCheck, 2701 that.name, argtypes, typeargtypes, referenceCheck,
2702 resultInfo.checkContext.inferenceContext()); 2702 resultInfo.checkContext.inferenceContext(),
2703 resultInfo.checkContext.deferredAttrContext().mode);
2703 } finally { 2704 } finally {
2704 resultInfo.checkContext.inferenceContext().rollback(saved_undet); 2705 resultInfo.checkContext.inferenceContext().rollback(saved_undet);
2705 } 2706 }
2706 2707
2707 Symbol refSym = refResult.fst; 2708 Symbol refSym = refResult.fst;
2717 case WRONG_MTHS: 2718 case WRONG_MTHS:
2718 case AMBIGUOUS: 2719 case AMBIGUOUS:
2719 case HIDDEN: 2720 case HIDDEN:
2720 case STATICERR: 2721 case STATICERR:
2721 case MISSING_ENCL: 2722 case MISSING_ENCL:
2723 case WRONG_STATICNESS:
2722 targetError = true; 2724 targetError = true;
2723 break; 2725 break;
2724 default: 2726 default:
2725 Assert.error("unexpected result kind " + refSym.kind); 2727 Assert.error("unexpected result kind " + refSym.kind);
2726 targetError = false; 2728 targetError = false;
2766 if (that.getMode() == ReferenceMode.INVOKE && 2768 if (that.getMode() == ReferenceMode.INVOKE &&
2767 TreeInfo.isStaticSelector(that.expr, names) && 2769 TreeInfo.isStaticSelector(that.expr, names) &&
2768 that.kind.isUnbound() && 2770 that.kind.isUnbound() &&
2769 !desc.getParameterTypes().head.isParameterized()) { 2771 !desc.getParameterTypes().head.isParameterized()) {
2770 chk.checkRaw(that.expr, localEnv); 2772 chk.checkRaw(that.expr, localEnv);
2771 }
2772
2773 if (!that.kind.isUnbound() &&
2774 that.getMode() == ReferenceMode.INVOKE &&
2775 TreeInfo.isStaticSelector(that.expr, names) &&
2776 !that.sym.isStatic()) {
2777 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
2778 diags.fragment("non-static.cant.be.ref", Kinds.kindName(refSym), refSym));
2779 result = that.type = types.createErrorType(target);
2780 return;
2781 }
2782
2783 if (that.kind.isUnbound() &&
2784 that.getMode() == ReferenceMode.INVOKE &&
2785 TreeInfo.isStaticSelector(that.expr, names) &&
2786 that.sym.isStatic()) {
2787 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
2788 diags.fragment("static.method.in.unbound.lookup", Kinds.kindName(refSym), refSym));
2789 result = that.type = types.createErrorType(target);
2790 return;
2791 } 2773 }
2792 2774
2793 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) && 2775 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
2794 exprType.getTypeArguments().nonEmpty()) { 2776 exprType.getTypeArguments().nonEmpty()) {
2795 //static ref with class type-args 2777 //static ref with class type-args

mercurial