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

Archie Cobbs acobbs at openjdk.org
Tue May 13 01:51:50 UTC 2025


> This PR refines the `-Werror` flag to support lint categories just like `-Xlint` does. So, for example `-Werror:all,-preview` would cause an error if any warning other than a `preview` warning occurred.
> 
> A few notes:
> * Some warnings emitted by the compiler do not have a corresponding `Lint` category. As always, they cause an error if `-Werror` is given, but what if `-Werror:all` is given instead? The answer given here is yes, an error will occur.
> * The `-Werror` works the same way as before, i.e., any warning results in an error. That means if `-Werror` is given `-Werror:foo` flags have no effect.
> * Refactoring has been done to allow `-Xlint` and `-Werror` to utilize the same "parsing" logic. The existing `-Xlint` flag has a particular behavior when conflicting flags are combined (e.g., `-Xlint:all -Xlint:none -Xlint:foo -Xlint:-foo` equals `-Xlint:all`). This behavior has been preserved and Javadocumented.
> * A few minor cleanups are included

Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:

  Update man page.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/23622/files
  - new: https://git.openjdk.org/jdk/pull/23622/files/646b7eca..9069f902

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=23622&range=01-02

  Stats: 7 lines in 1 file changed: 5 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/23622.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23622/head:pull/23622

PR: https://git.openjdk.org/jdk/pull/23622


More information about the compiler-dev mailing list