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

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Jan 24 12:34:35 UTC 2024


On Wed, 24 Jan 2024 11:53:52 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:
> 
>   Set previewEnabled properly in SwitchBootstraps

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4147:

> 4145:         }
> 4146:         if (clazztype.isPrimitive()) {
> 4147:             preview.checkSourceLevel(tree.pattern.pos(), Feature.PRIMITIVE_PATTERNS);

So, if I have a primitive instanceof, I get two preview warnings, one for the expression, and one for the pattern type? Shouldn't one be enough?

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

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


More information about the core-libs-dev mailing list