No way to add back lint categories after "none"

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 25
    • Affects Version/s: 24, 25
    • Component/s: tools
    • Environment:

      openjdk version "24" 2025-03-18
      OpenJDK Runtime Environment (build 24+36-3646)
      OpenJDK 64-Bit Server VM (build 24+36-3646, mixed mode, sharing)

    • b22
    • generic
    • generic

      If "foo" is any non-mandatory lint category (for example, "serial") then a javac flag like "-Xlint:none,foo" is being handled incorrectly by the compiler.

      Whereas "-Xlint:all,-foo" means "Enable all categories, then remove foo", the flag "-Xlint:none,foo" should mean "Disable all categories, then add foo".

      However, the actual effect of "-Xlint:none,foo" is the same as "-Xlint:none", that is, "Disable all categories, period."

      Reproducer:

          $ cat NoSUID.java
          class NoSUID implements java.io.Serializable { }
          $ javac -Xlint:all NoSUID.java
          NoSUID.java:1: warning: [serial] serializable class NoSUID has no definition of serialVersionUID
          class NoSUID implements java.io.Serializable { }
          ^
          1 warning
          $ javac -Xlint:all,-serial NoSUID.java
          $ javac -Xlint:none NoSUID.java
          $ javac -Xlint:none,serial NoSUID.java # MISSING WARNING HERE
          $ javac -Xlint:serial NoSUID.java
          NoSUID.java:1: warning: [serial] serializable class NoSUID has no definition of serialVersionUID
          class NoSUID implements java.io.Serializable { }
          ^
          1 warning
          $ javac -version
          javac 24

        There are no Sub-Tasks for this issue.

            Assignee:
            Archie Cobbs
            Reporter:
            Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: