RFR: 8332522: SwitchBootstraps::mappedEnumLookup constructs unused array [v2]

ExE Boss duke at openjdk.org
Thu Jun 27 19:04:26 UTC 2024


On Thu, 27 Jun 2024 15:25:36 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Reflecting review feedback.
>
> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 286:
> 
>> 284:             labels[i] = convertedLabel;
>> 285:             constantsOnly &=
>> 286:                     EnumDesc.class.isAssignableFrom(convertedLabel.getClass());
> 
> Suggestion:
> 
>             if (constantsOnly)
>                 constantsOnly = EnumDesc.class.isAssignableFrom(convertedLabel.getClass());
> 
> 
> `&=` does not short-circuit the `isAssignableFrom` evaluation.

It’d have to be `&&=`, but I don’t think **Java** supports that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19906#discussion_r1657679033


More information about the core-libs-dev mailing list