2530 } |
2530 } |
2531 final Env<AttrContext> localEnv = env.dup(that); |
2531 final Env<AttrContext> localEnv = env.dup(that); |
2532 try { |
2532 try { |
2533 //attribute member reference qualifier - if this is a constructor |
2533 //attribute member reference qualifier - if this is a constructor |
2534 //reference, the expected kind must be a type |
2534 //reference, the expected kind must be a type |
2535 Type exprType = attribTree(that.expr, |
2535 Type exprType = attribTree(that.expr, env, memberReferenceQualifierResult(that)); |
2536 env, new ResultInfo(that.getMode() == ReferenceMode.INVOKE ? VAL | TYP : TYP, Type.noType)); |
|
2537 |
2536 |
2538 if (that.getMode() == JCMemberReference.ReferenceMode.NEW) { |
2537 if (that.getMode() == JCMemberReference.ReferenceMode.NEW) { |
2539 exprType = chk.checkConstructorRefType(that.expr, exprType); |
2538 exprType = chk.checkConstructorRefType(that.expr, exprType); |
2540 } |
2539 } |
2541 |
2540 |
2686 resultInfo.checkContext.report(that, cause); |
2685 resultInfo.checkContext.report(that, cause); |
2687 result = that.type = types.createErrorType(pt()); |
2686 result = that.type = types.createErrorType(pt()); |
2688 return; |
2687 return; |
2689 } |
2688 } |
2690 } |
2689 } |
|
2690 //where |
|
2691 ResultInfo memberReferenceQualifierResult(JCMemberReference tree) { |
|
2692 //if this is a constructor reference, the expected kind must be a type |
|
2693 return new ResultInfo(tree.getMode() == ReferenceMode.INVOKE ? VAL | TYP : TYP, Type.noType); |
|
2694 } |
|
2695 |
2691 |
2696 |
2692 @SuppressWarnings("fallthrough") |
2697 @SuppressWarnings("fallthrough") |
2693 void checkReferenceCompatible(JCMemberReference tree, Type descriptor, Type refType, CheckContext checkContext, boolean speculativeAttr) { |
2698 void checkReferenceCompatible(JCMemberReference tree, Type descriptor, Type refType, CheckContext checkContext, boolean speculativeAttr) { |
2694 Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType()); |
2699 Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType()); |
2695 |
2700 |