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

Aggelos Biboudis abimpoudis at openjdk.org
Wed Jan 24 15:55:55 UTC 2024


On Wed, 24 Jan 2024 12:20:55 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 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/code/Types.java line 5046:
> 
>> 5044: 
>> 5045:         if (target.isPrimitive()) {
>> 5046:             return (source.isReference() && isSubtype(source, target)) ||
> 
> I'm a bit confused here - in here we have:
> * `target.isPrimitive()`
> * `source.isReference()`
> 
> So, isn't it the case that `isSubtype(source, target)` is always false?

Yes! Thanks for spotting. https://github.com/openjdk/jdk/pull/15638/commits/0fcdca8229c0db81fe3503770ed155a6aaa4f250

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

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


More information about the core-libs-dev mailing list