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

Log class should have a proper clear() method

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 25
    • 25
    • tools
    • jdk-25+9-73-gba28119642a

    • b18
    • generic
    • generic

      This is a minor refactoring/cleanup issue.

      The Log singleton gets reused in the class JavacTaskPool, via a subclass called ReusableLog. That class has a clear() method that resets some, but not all, of the fields in its superclass, Log.

      It only clears some of the fields in part because new fields were added to Log after ReusableLog was created (nsuppressederrors and nsuppressedwarns), but ReusableLog was not updated to also clear those fields.

      Instead, following the principle of proper encapsulation, the class Log itself should be responsible for clearing its own fields, and ReusableLog.clear() should invoke super.clear() as its first statement. This should help avoid easy "misses" in the clear() method after future changes.

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

              Created:
              Updated:
              Resolved: