RFR: 8344079: Minor fixes and cleanups to compiler lint-related code [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Nov 29 13:06:44 UTC 2024


On Thu, 14 Nov 2024 02:58:57 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

>> Please review these changes with some minor lint-related fixes and cleanups.
>> 
>> See [JDK-8344079](https://bugs.openjdk.org/browse/JDK-8344079) for a more detailed description.
>
> Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8344079
>  - Fix typo in comment.
>  - Minor lint-related cleanups.

src/jdk.compiler/share/classes/com/sun/tools/javac/code/LintSuppression.java line 49:

> 47:  *  deletion without notice.</b>
> 48:  */
> 49: public class LintSuppression {

Question: why is this a separate class? E.g. as opposed to just add the methods in this class to the main `Lint` class? After all, it seems that `LintSuppression` has no meaningful state so to speak - it seems mostly a collection of "helper methods". I'd use more encapsulation, as these methods should proabably never used outside `Lint` itself?

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java line 1365:

> 1363: 
> 1364:             if (!incubatingModules.isEmpty()) {
> 1365:                 log.warning(LintCategory.INCUBATING, null, Warnings.IncubatingModules(incubatingModules));

Thanks for fixing all these. IMHO the fact we had so many bad usages points at the fact that the system we use to report warning is a bit too loose. I wonder if we should differentiate warning keys from lint warning keys, and have lint warnings be reported with a dedicated method in `Log`, so that there can be no confusion as to which is which (this is for a separate, possible, future PR)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22056#discussion_r1863495369
PR Review Comment: https://git.openjdk.org/jdk/pull/22056#discussion_r1863497722


More information about the compiler-dev mailing list