1831 chk.checkRefTypes(tree.typeargs, typeargtypes); |
1831 chk.checkRefTypes(tree.typeargs, typeargtypes); |
1832 |
1832 |
1833 // Check that value of resulting type is admissible in the |
1833 // Check that value of resulting type is admissible in the |
1834 // current context. Also, capture the return type |
1834 // current context. Also, capture the return type |
1835 result = check(tree, capture(restype), VAL, resultInfo); |
1835 result = check(tree, capture(restype), VAL, resultInfo); |
1836 |
|
1837 if (localEnv.info.lastResolveVarargs()) |
|
1838 Assert.check(result.isErroneous() || tree.varargsElement != null); |
|
1839 } |
1836 } |
1840 chk.validate(tree.typeargs, localEnv); |
1837 chk.validate(tree.typeargs, localEnv); |
1841 } |
1838 } |
1842 //where |
1839 //where |
1843 Type adjustMethodReturnType(Type qualifierType, Name methodName, List<Type> argtypes, Type restype) { |
1840 Type adjustMethodReturnType(Type qualifierType, Name methodName, List<Type> argtypes, Type restype) { |
3731 resultInfo, |
3728 resultInfo, |
3732 argtypes, |
3729 argtypes, |
3733 typeargtypes, |
3730 typeargtypes, |
3734 noteWarner); |
3731 noteWarner); |
3735 |
3732 |
|
3733 DeferredAttr.DeferredTypeMap checkDeferredMap = |
|
3734 deferredAttr.new DeferredTypeMap(DeferredAttr.AttrMode.CHECK, sym, env.info.pendingResolutionPhase); |
|
3735 |
|
3736 argtypes = Type.map(argtypes, checkDeferredMap); |
|
3737 |
|
3738 if (noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)) { |
|
3739 chk.warnUnchecked(env.tree.pos(), |
|
3740 "unchecked.meth.invocation.applied", |
|
3741 kindName(sym), |
|
3742 sym.name, |
|
3743 rs.methodArguments(sym.type.getParameterTypes()), |
|
3744 rs.methodArguments(Type.map(argtypes, checkDeferredMap)), |
|
3745 kindName(sym.location()), |
|
3746 sym.location()); |
|
3747 owntype = new MethodType(owntype.getParameterTypes(), |
|
3748 types.erasure(owntype.getReturnType()), |
|
3749 types.erasure(owntype.getThrownTypes()), |
|
3750 syms.methodClass); |
|
3751 } |
|
3752 |
3736 return chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(), |
3753 return chk.checkMethod(owntype, sym, env, argtrees, argtypes, env.info.lastResolveVarargs(), |
3737 noteWarner.hasNonSilentLint(LintCategory.UNCHECKED), resultInfo.checkContext.inferenceContext()); |
3754 resultInfo.checkContext.inferenceContext()); |
3738 } catch (Infer.InferenceException ex) { |
3755 } catch (Infer.InferenceException ex) { |
3739 //invalid target type - propagate exception outwards or report error |
3756 //invalid target type - propagate exception outwards or report error |
3740 //depending on the current check context |
3757 //depending on the current check context |
3741 resultInfo.checkContext.report(env.tree.pos(), ex.getDiagnostic()); |
3758 resultInfo.checkContext.report(env.tree.pos(), ex.getDiagnostic()); |
3742 return types.createErrorType(site); |
3759 return types.createErrorType(site); |