RFR: 8333107: javac fails with an exception when processing broken lambda

Adam Sotona asotona at openjdk.org
Thu May 30 06:16:33 UTC 2024


On Wed, 29 May 2024 10:56:25 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> When javac encounters a broken code around lambda, it attempts to recover from the problem. One possible problem is a missing return (when the lambda is no expected to be void-compatible), or a return with a value (when the lambda is expected to be void compatible). The recovery attempts to adjust the lambda to conform to the expectations, so it can be attributed.
> 
> It tries to not touch embedded lambdas and classes, but it does not do that correctly - it just does nothing at all for these. But `TreeTranslator` will then replace the embedded lambdas and classes with `null`, leading to problems when the translated tree is processed/attributed.
> 
> The proposed solution is to correctly retain the existing trees for embedded lambdas and classes by copying the trees to the `result` variable.

It looks good to me (except for the trailing whitespaces in the test).

-------------

Marked as reviewed by asotona (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19451#pullrequestreview-2085393876


More information about the compiler-dev mailing list