On Mon, 28 Jul 2025 21:10:24 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Reverting runtime checks, as suggested.
>
> make/langtools/tools/flagsgenerator/FlagsGenerator.java line 84:
> 
>> 82:                                            .forEach(target -> 
>> target2FlagBit2Fields.computeIfAbsent(target, _ -> new HashMap<>())
>> 83:                                                                          
>>           .computeIfAbsent(flagBit, _ -> new ArrayList<>())
>> 84:                                                                          
>>           .add(flagName));
> 
> Instead of a dedicated loop to verify no overlaps, we can make the nested map 
> `Map<Integer, String>` and fail fast whenever we detect a conflict, like:
> 
> var oldFlagName = target2FlagBit2Fields.computeIfAbsent(target, _ -> new 
> HashMap<>()).put(flagBit, flagName);
> if (oldFlagName != null) {
>     // Fail fast code
> }
> 
> I personally don't see a reason to collect all conflicting fields for a flag 
> if any of these conflicts already causes a failure.

Its unlikely to be common in the long run, but there may be conflicts among 
more than two fields. Reporting all at once (rather than reporting one 
conflict, and after resolving reporting another) seems nicer.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26452#discussion_r2266167613

Reply via email to