RFR: 8348410: Preview flag not checked during compilation resulting in runtime crash
Aggelos Biboudis
abimpoudis at openjdk.org
Mon May 5 09:28:53 UTC 2025
On Fri, 24 Jan 2025 18:43:27 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> JEP 455 adds support for `switch`'ing on `long`, `float`, `double`, and `boolean`. Since this feature is still in preview, the `--enable-preview` flag is required. The compiler was properly checking that when the expressions had primitive type, but not when the expression a corresponding boxed type (i.e., `Long`, `Float`, `Double`, and `Boolean`). This resulted in `BootstrapMethodError` failures at runtime. This PR closes that loophole.
>
> I think the check needs to be on a different place - please see inline.
I had a look and I think what @lahodaj meant was something like this: https://github.com/biboudis/jdk/commit/f05394c9025f6a93d283e1bfe1a26ef83f5ca0b8
Instead of me creating a new PR, @archiecobbs you can reopen yours, merge here my commit above and rereview. What do you think? :-)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23303#issuecomment-2850422390
More information about the compiler-dev
mailing list