RFR: 8333107: javac fails with an exception when processing broken lambda
Jan Lahoda
jlahoda at openjdk.org
Thu May 30 06:16:33 UTC 2024
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.
-------------
Commit messages:
- Removing trailing whitespace
- Merge remote-tracking branch 'upstream/master' into JDK-8333107
- Improving test.
- 8333107: javac fails with an exception when processing broken lambda
Changes: https://git.openjdk.org/jdk/pull/19451/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19451&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8333107
Stats: 50 lines in 2 files changed: 48 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/19451.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19451/head:pull/19451
PR: https://git.openjdk.org/jdk/pull/19451
More information about the compiler-dev
mailing list