RFR: 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview) [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Oct 3 09:02:16 UTC 2023


On Mon, 2 Oct 2023 14:47:59 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> This is the first draft of a patch for Primitive types in patterns, instanceof, and switch (Preview).
>> 
>> Draft spec here: https://cr.openjdk.org/~abimpoudis/instanceof/instanceof-20230913/specs/instanceof-jls.html
>
> Aggelos Biboudis has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge branch 'master' into primitive-patterns
>  - Implement type pairs to exactnessMethod name
>  - Apply suggestions from code review
>    
>    Co-authored-by: Raffaello Giulietti <raffaello.giulietti at oracle.com>
>  - 8303374: Compiler Implementation for Primitive types in patterns, instanceof, and switch (Preview)

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 2982:

> 2980:                     // =>
> 2981:                     // if (let tmp$123 = v; ExactnessChecks.int_float(tmp$123))
> 2982:                     JCIdent argument = make.Ident(dollar_s);

In principle you don't need a synthetic variable here... (but it's ok if you prefer to leave for uniformity)

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

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


More information about the compiler-dev mailing list