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

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jan 26 12:02:54 UTC 2026


On Mon, 26 Jan 2026 11:54:52 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Attempting to use the number of 'base checks' as the limit, instead of wall-clock time.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java line 237:
> 
>> 235:                                                   StringUtils.toLowerCase(tag.name()));
>> 236:         }
>> 237:         else if (arg instanceof BindingPattern bp) {
> 
> Have you tried playing with the Formattable interface? This is used by diagnostic formatters as an escape hatch to provide custom formatting -- but probably that's not good enough, as Formattable expects to just map an object into a string w/o the help of a formatter -- which is clearly not the case here. Maybe just having an abstract `String format(AbstractDiagnosticFormatter)` in PatternDescription could be enough -- then the code here doesn't have to worry about all possible cases.

That said, in Rich formatter we also need to preprocess, so perhaps keeping the code as is here would be more symmetric...

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

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


More information about the build-dev mailing list