RFR: 8367530: The exhaustiveness errors could be improved [v6]

Jan Lahoda jlahoda at openjdk.org
Thu Nov 13 17:07:50 UTC 2025


On Thu, 13 Nov 2025 11:07:13 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Apply suggestions from code review
>>   
>>   Co-authored-by: Aggelos Biboudis <biboudis at gmail.com>
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java line 699:
> 
>> 697:                                 TreeInfo.isErrorEnumSwitch(tree.selector, tree.cases);
>> 698:             if (exhaustiveSwitch) {
>> 699:                 tree.isExhaustive |= exhaustiveness.exhausts(tree.selector, tree.cases);
> 
> This `|=` turned into `=`. Is that correct? I think so. Now it is guarded by `tree.isExhaustive` itself right?

Yes, this is intentional. There is one more additional `if (!tree.isExhaustive)` test below, which replaces the use of the or (but is faster in case we know the switch is exhaustive).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27256#discussion_r2524257070


More information about the compiler-dev mailing list