RFR: 8354090: Refactor import warning suppression in Check.java
Archie Cobbs
acobbs at openjdk.org
Wed Apr 9 01:27:52 UTC 2025
This is split off as a sub-task of [JDK-8224228](https://bugs.openjdk.org/browse/JDK-8224228), which seeks to add `@SuppressWarnings` support for lexical features.
In JDK 9 and later, there is a special exception to the normal rules for deprecation and preview warnings, which is that these warnings are automatically suppressed for import statements. This is because an import statement is just a lexical shortcut, not an actual use of the symbol.
The current code in `Check.java` implements this by manipulating the current `Lint` instance directly, but this operation is incompatible upcoming changes to deferred lint handling. Instead, there can be an explicit flag for "import warning suppression" in `Check.java` to handle this. This will also make the code a bit clearer.
-------------
Commit messages:
- Bump copyright.
- Refactor handling of DEPRECATION_ON_IMPORT via new flag Check.importSuppression.
Changes: https://git.openjdk.org/jdk/pull/24532/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24532&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8354090
Stats: 33 lines in 3 files changed: 12 ins; 10 del; 11 mod
Patch: https://git.openjdk.org/jdk/pull/24532.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24532/head:pull/24532
PR: https://git.openjdk.org/jdk/pull/24532
More information about the compiler-dev
mailing list