RFR: 8349847: Support configuring individual lint categories as errors
Archie Cobbs
acobbs at openjdk.org
Fri May 30 21:31:09 UTC 2025
(Note: this is a resubmission of #23622 which was closed accidentally due to a [bot bug](https://bugs.openjdk.org/browse/SKARA-2510) and which I'm not allowed to reopen.)
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` ca[tegory. 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
-------------
Commit messages:
- Merge branch 'master' into JDK-8349847 to fix conflicts.
- Update man page.
- Merge branch 'master' into JDK-8349847 to fix conflicts.
- Add support for -Werror:key.
Changes: https://git.openjdk.org/jdk/pull/25558/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25558&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8349847
Stats: 196 lines in 13 files changed: 140 ins; 34 del; 22 mod
Patch: https://git.openjdk.org/jdk/pull/25558.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25558/head:pull/25558
PR: https://git.openjdk.org/jdk/pull/25558
More information about the compiler-dev
mailing list