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

ExE Boss duke at openjdk.org
Thu Feb 1 13:53:34 UTC 2024


On Wed, 31 Jan 2024 10:03:23 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> This is the proposed patch for Primitive types in patterns, instanceof, and switch (Preview).
>> 
>> Draft spec here: https://cr.openjdk.org/~abimpoudis/instanceof/latest/
>
> Aggelos Biboudis has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 78 commits:
> 
>  - Merge branch 'master' into primitive-patterns
>  - Update summary in ExactnessConversionsSupportTest
>  - Address review by Jan
>  - Remove redundant null check  and introduce a const boolean for unconditionally exact pairs
>  - Small fix in Javadoc
>  - Tidy up Javadoc of Lower.visitTypeTest
>  - Tidy up Javadoc of IllegalArgumentException in typeSwitch
>  - Improve readability in SwitchBootstraps
>  - Update year
>  - Cleanup redundant clone
>  - ... and 68 more: https://git.openjdk.org/jdk/compare/ec56c72b...f68748b1

src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 721:

> 719:             typePairToName.put(new TypePairs(double.class, long.class),   "isDoubleToLongExact");
> 720:             typePairToName.put(new TypePairs(double.class, float.class),  "isDoubleToFloatExact");
> 721:             return typePairToName;

This should return an immutable map, so that `TypePairs` lookups can be treated as constant:
Suggestion:

            return Map.copyOf(typePairToName);

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

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


More information about the compiler-dev mailing list