Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8349155

The "log" parameter to Lint.logIfEnabled() is not needed

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 25
    • 25
    • tools
    • jdk-25+7-43-g907350e9e8e

    • 25
    • b09
    • generic
    • generic

      In JDK-8345263, a new method Lint.logIfEnabled(Log log, DiagnosticPosition pos, LintWarning warning) was added.

      For simplicity, and to avoid possible initialization ordering issues, it was decided at the time to pass a "log" parameter explicitly instead of having Lint keep its own reference to the Log singleton.

      After some other recent changes (JDK-8344079, JDK-8347474) the initialization ordering issues have been alleviated. So the "log" parameter can be removed and Lint can just keep its own reference.

      Code inspection reveals that there is only ever one Log instance per Context, so it's not possible for the "log" to be wrong in doing this. This was also verified by adding an assertion check and running the compiler test suite.

            acobbs Archie Cobbs
            acobbs Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: