RFR: 8303374: Implement JEP 455: Primitive Types in Patterns, instanceof, and switch (Preview) [v44]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Jan 25 10:15:45 UTC 2024


On Wed, 24 Jan 2024 15:37:58 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Aggelos Biboudis has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Enhance Javadoc of ExactConversionsSupport (2)
>>  - Enhance Javadoc of ExactConversionsSupport
>
> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 471:
> 
>> 469:                                     // o instanceof float
>> 470:                                     Label notNumber = cb.newLabel();
>> 471:                                     cb.aload(0);
> 
> we are wiring constants into code generation: `0`, `3` etc, probably those won't change but I would prefer using static final fields or enums, that can be documented and changed easily in the future if needed

Note also that the classfile API supports an higher-level construct to access method parameters, which supports _logical_ indexes (see CodeBuilder::parameterSlot). This would make the indices more robust against changes in types (e.g. int vs. long, where the latter would require two local variable slots)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1466139675


More information about the core-libs-dev mailing list