RFR: 8303374: Implement JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview) [v50]
Jan Lahoda
jlahoda at openjdk.org
Thu Jan 25 10:54:36 UTC 2024
On Thu, 25 Jan 2024 10:15:48 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update year
>
> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 592:
>
>> 590: element.caseLabel() instanceof Double ||
>> 591: element.caseLabel() instanceof Boolean)) {
>> 592: //TODO: should call equals on the constant, not on the selector, check
>
> Looking at the code, it seems like we're already calling equals on the constant? (I assume that's to avoid spurious NPEs?)
The note there was to double-check that for selector `s` and constant `l`, we do something like `Long.valueOf(l).equals(s)`, not `s.equals(Long.valueOf(l))`, as the latter does not have the proper semantics. I believe Angelos is adding a test checking this is (and remains) the case.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1466189962
More information about the core-libs-dev
mailing list