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

changeset 1610
08782b8b03ce
parent 1607
bd49e0304281
child 1615
12202e6ab78a
equal deleted inserted replaced
1609:332f23993353 1610:08782b8b03ce
2622 } 2622 }
2623 2623
2624 that.sym = refSym.baseSymbol(); 2624 that.sym = refSym.baseSymbol();
2625 that.kind = lookupHelper.referenceKind(that.sym); 2625 that.kind = lookupHelper.referenceKind(that.sym);
2626 2626
2627 if (desc.getReturnType() == Type.recoveryType) {
2628 // stop here
2629 result = that.type = target;
2630 return;
2631 }
2632
2627 if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) { 2633 if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) {
2634
2635 if (!that.kind.isUnbound() &&
2636 that.getMode() == ReferenceMode.INVOKE &&
2637 TreeInfo.isStaticSelector(that.expr, names) &&
2638 !that.sym.isStatic()) {
2639 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
2640 diags.fragment("non-static.cant.be.ref", Kinds.kindName(refSym), refSym));
2641 result = that.type = types.createErrorType(target);
2642 return;
2643 }
2644
2645 if (that.kind.isUnbound() &&
2646 that.getMode() == ReferenceMode.INVOKE &&
2647 TreeInfo.isStaticSelector(that.expr, names) &&
2648 that.sym.isStatic()) {
2649 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
2650 diags.fragment("static.method.in.unbound.lookup", Kinds.kindName(refSym), refSym));
2651 result = that.type = types.createErrorType(target);
2652 return;
2653 }
2654
2628 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) && 2655 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) &&
2629 exprType.getTypeArguments().nonEmpty()) { 2656 exprType.getTypeArguments().nonEmpty()) {
2630 //static ref with class type-args 2657 //static ref with class type-args
2631 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), 2658 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
2632 diags.fragment("static.mref.with.targs")); 2659 diags.fragment("static.mref.with.targs"));
2645 2672
2646 if (!refSym.isStatic() && that.kind == JCMemberReference.ReferenceKind.SUPER) { 2673 if (!refSym.isStatic() && that.kind == JCMemberReference.ReferenceKind.SUPER) {
2647 // Check that super-qualified symbols are not abstract (JLS) 2674 // Check that super-qualified symbols are not abstract (JLS)
2648 rs.checkNonAbstract(that.pos(), that.sym); 2675 rs.checkNonAbstract(that.pos(), that.sym);
2649 } 2676 }
2650 }
2651
2652 if (desc.getReturnType() == Type.recoveryType) {
2653 // stop here
2654 result = that.type = target;
2655 return;
2656 } 2677 }
2657 2678
2658 that.sym = refSym.baseSymbol(); 2679 that.sym = refSym.baseSymbol();
2659 that.kind = lookupHelper.referenceKind(that.sym); 2680 that.kind = lookupHelper.referenceKind(that.sym);
2660 2681

mercurial