[code-reflection] RFR: Unreachable method or lambda exit [v2]

Paul Sandoz psandoz at openjdk.org
Mon Oct 21 16:39:47 UTC 2024


On Mon, 21 Oct 2024 10:19:38 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> What changes is the interpretation of `;` in the absence/presence of `{ }`. Without braces, the `;` is interpreted as part of the `while`. So everything is ok. But with the braces, `;` is no longer part of the `while`, but an (optional) empty statement following the `while` - which is unreachable :-)

Ha! Very good. Definitely an interesting puzzler :-)

I have sometimes wondered if "we" made the right decision on detecting certain unreachable code, it feels "best-effort" and there are always obvious cases (to the human or other tooling) that the compiler does not reject.

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

PR Comment: https://git.openjdk.org/babylon/pull/257#issuecomment-2427175622


More information about the babylon-dev mailing list