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

Vicente Romero vromero at openjdk.org
Wed Jan 24 17:32:38 UTC 2024


On Wed, 24 Jan 2024 15:55:51 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 incrementally with one additional commit since the last revision:
> 
>   Remove redundant test from checkUnconditionallyExact

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

> 166:         requireNonNull(labels);
> 167: 
> 168:         labels = labels.clone();

just curious, why do we need to clone this array?

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

> 403:      */
> 404:     @SuppressWarnings("removal")
> 405:     private static MethodHandle generateInnerClass(MethodHandles.Lookup caller, Class<?> selectorType, Object[] labels) {

again a matter of style but it seems to me that the huge lambda inside of this method, starting in line 409, really wants to be a separate helper method. That will probably be a better refactoring as we won't be mixing byte code generation with method handles manipulation.

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

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


More information about the core-libs-dev mailing list