RFR: 8328747: WrongMethodTypeException with pattern matching on switch on sealed classes [v2]

Liam Miller-Cushon cushon at openjdk.org
Wed Apr 3 19:02:08 UTC 2024


On Wed, 3 Apr 2024 15:00:25 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> This PR addresses the issue that the expected signature for `typeSwitch` is different when a release target refers to a version prior to JDK 23. The signature, due to JEP 455, needs to be more precise on the `selectorType` now that primitive type support is previewed.
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Append empty line

This looks good to me.

I double-checked that it fixes the original code that I minimized for the bug report. Thanks for the fix!

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java line 232:

> 230:     /** Releases prior to JDK 23 expect a less precise SwitchBootstraps.typeSwitch signature on the selectorType
> 231:      */
> 232:     public boolean releaseAfterJEP455() {

Perhaps consider a more descriptive method name instead of referring to the JEP number, for consistency with the other method names in this class.

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

Marked as reviewed by cushon (Committer).

PR Review: https://git.openjdk.org/jdk/pull/18606#pullrequestreview-1977714422
PR Review Comment: https://git.openjdk.org/jdk/pull/18606#discussion_r1550297407


More information about the compiler-dev mailing list