RFR: 8349847: Support configuring individual lint categories as errors [v8]

Archie Cobbs acobbs at openjdk.org
Thu Aug 14 03:50:29 UTC 2025


On Wed, 13 Aug 2025 21:11:04 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits:
>> 
>>  - Merge branch 'master' into JDK-8349847 to fix cross-compiling build problem.
>>  - Merge branch 'master' into JDK-8349847 to fix conflicts.
>>  - Merge branch 'master' into JDK-8349847 to fix conflicts.
>>  - Merge branch 'JDK-8359596' into JDK-8349847 to add "-Xlint:none" fix.
>>  - Ensure that "-Xlint:none" still works for the affected warnings.
>>    
>>    The extra checks for "-Xlint:none" are needed now because of JDK-8352612,
>>    which changed the behavior of "-Xlint:none" to no longer imply "-nowarn",
>>    which allowed the affected warnings to get away with skipping that check.
>>  - Minor naming and Javadoc tweaks.
>>  - Merge branch 'JDK-8359596' into JDK-8349847
>>  - No need for /nodynamiccopyright/ with this test.
>>  - Restore behavior when both -Xlint:options and -Xlint:-options are given.
>>  - Merge branch 'master' into JDK-8349847
>>  - ... and 4 more: https://git.openjdk.org/jdk/compare/5f357fa2...2bdc2ab0
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java line 176:
> 
>> 174:     /**
>> 175:      * Determine if a specific {@link LintCategory} is enabled via a custom
>> 176:      * option flag of the form {@code -Flag}, {@code -Flag:all}, or {@code -Flag:key}.
> 
> nit: `Flag` seems to imply that any flag is acceptable when only two are

Thanks - should be fixed in e8f5539f3a1.

> src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java line 248:
> 
>> 246:      *
>> 247:      * <p>
>> 248:      * The set of categories is calculated as folllows. First, an initial set is created:
> 
> typo: `folllows`

Thanks - should be fixed in e8f5539f3a1.

> src/jdk.compiler/share/classes/com/sun/tools/javac/util/Options.java line 268:
> 
>> 266: 
>> 267:         // Create the initial set
>> 268:         EnumSet<LintCategory> categories;
> 
> should we check that the option parameter is either `Xlint` or `Werror`?

Good point - it happens by virtue of the call to `Option.getCustom()` which throws an exception if no custom option exists, but not perfectly - that method only checks for the existence of a matching enum value ending in `_CUSTOM`, and such values also exist for `-g` and `-Xdoclint`. That has been tightened up in e8f5539f3a1.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23622#discussion_r2275264827
PR Review Comment: https://git.openjdk.org/jdk/pull/23622#discussion_r2275264879
PR Review Comment: https://git.openjdk.org/jdk/pull/23622#discussion_r2275264992


More information about the compiler-dev mailing list