equal
deleted
inserted
replaced
317 /** we need to save the inference context before generating target type constraints. |
317 /** we need to save the inference context before generating target type constraints. |
318 * This constraints may pollute the inference context and make it useless in case we |
318 * This constraints may pollute the inference context and make it useless in case we |
319 * need to use it several times: with several targets. |
319 * need to use it several times: with several targets. |
320 */ |
320 */ |
321 saved_undet = inferenceContext.save(); |
321 saved_undet = inferenceContext.save(); |
322 if (allowGraphInference && !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) { |
322 boolean unchecked = warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED); |
|
323 if (allowGraphInference && !unchecked) { |
323 boolean shouldPropagate = shouldPropagate(getReturnType(), resultInfo, inferenceContext); |
324 boolean shouldPropagate = shouldPropagate(getReturnType(), resultInfo, inferenceContext); |
324 |
325 |
325 InferenceContext minContext = shouldPropagate ? |
326 InferenceContext minContext = shouldPropagate ? |
326 inferenceContext.min(roots(asMethodType(), null), false, warn) : |
327 inferenceContext.min(roots(asMethodType(), null), false, warn) : |
327 inferenceContext; |
328 inferenceContext; |
336 resultInfo.checkContext.deferredAttrContext().insideOverloadPhase()); |
337 resultInfo.checkContext.deferredAttrContext().insideOverloadPhase()); |
337 return newRestype; |
338 return newRestype; |
338 } |
339 } |
339 } |
340 } |
340 inferenceContext.solve(noWarnings); |
341 inferenceContext.solve(noWarnings); |
341 return inferenceContext.asInstType(this).getReturnType(); |
342 Type ret = inferenceContext.asInstType(this).getReturnType(); |
|
343 //inline logic from Attr.checkMethod - if unchecked conversion was required, erase |
|
344 //return type _after_ resolution |
|
345 return unchecked ? types.erasure(ret) : ret; |
342 } catch (InferenceException ex) { |
346 } catch (InferenceException ex) { |
343 resultInfo.checkContext.report(null, ex.getDiagnostic()); |
347 resultInfo.checkContext.report(null, ex.getDiagnostic()); |
344 Assert.error(); //cannot get here (the above should throw) |
348 Assert.error(); //cannot get here (the above should throw) |
345 return null; |
349 return null; |
346 } finally { |
350 } finally { |