RFR 8178427: NPE in Infer$CheckUpperBounds
Vicente Romero
vicente.romero at oracle.com
Tue Nov 28 18:41:03 UTC 2017
looks good,
Vicente
On 11/28/2017 01:21 PM, Maurizio Cimadamore wrote:
> Hi,
> please review this patch which fixes a javac crash during inference:
>
> http://cr.openjdk.java.net/~mcimadamore/8178427/
>
> This crash is caused by the fact that we enter in
> PartiallyInferredMethod.check() routine with a result info that has
> the target type set to void.
>
> This is a consequence of the fact that the overloadCheck() method for
> explicit lambdas in ArgumentAttr does not report errors when you have
> a statement lambda and the statement lambda contains a 'return'
> statement that doesn't match the expected target type - more
> specifically, if it's a 'return' w/o expression, the target type must
> be void; if it's a 'return E', then the target-type must be non-void.
>
> In JDK8 we used to carry out these checks in Attr.visitReturn (during
> speculative attr), so we never really checked the guts of the return
> expression if the expected type was void, as visitReturn would throw
> and make applicability fail.
>
> The solution is to partially replicate the Attr.visitReturn logic in
> ArgumentAttr, to make sure that we don't end up calling checks where
> we did not use to.
>
> Since I was there, I've simplified the logic a little bit, and made it
> more explicit.
>
> Cheers
> Maurizio
>
More information about the compiler-dev
mailing list