Integrated: 8348410: Preview flag not checked during compilation resulting in runtime crash

Archie Cobbs acobbs at openjdk.org
Mon May 12 14:45:07 UTC 2025


On Fri, 24 Jan 2025 17:12:00 GMT, Archie Cobbs <acobbs 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.

This pull request has now been integrated.

Changeset: f5525ecf
Author:    Archie Cobbs <acobbs at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/f5525ecf585b3876ae332d30b0e641ff0c844e58
Stats:     186 lines in 2 files changed: 182 ins; 0 del; 4 mod

8348410: Preview flag not checked during compilation resulting in runtime crash

Co-authored-by: Aggelos Biboudis <abimpoudis at openjdk.org>
Reviewed-by: jlahoda, mcimadamore

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

PR: https://git.openjdk.org/jdk/pull/23303


More information about the compiler-dev mailing list