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

Address use of default constructors in java.logging

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 16
    • core-libs
    • None
    • minimal
    • Explicit constructors are equivalent to the previous implicit ones.
    • Java API
    • SE

      Summary

      Add explicit constructors to two classes in java.logging using default constructors.

      Problem

      Default constructors are not recommend for formal API classes.

      Solution

      Add the elided constructors.

      Specification

      --- old/src/java.logging/share/classes/java/util/logging/ErrorManager.java  2020-07-23 10:30:58.570574191 -0700
      +++ new/src/java.logging/share/classes/java/util/logging/ErrorManager.java  2020-07-23 10:30:58.126574191 -0700
      @@ -39,6 +39,11 @@
       public class ErrorManager {
          private boolean reported = false;
      
      +    /**
      +     * Create an {@code ErrorManager}.
      +     */
      +    public ErrorManager() {}
      +
           /*
            * We declare standard error codes for important categories of errors.
            */
      --- old/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java   2020-07-23 10:30:59.390574191 -0700
      +++ new/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java   2020-07-23 10:30:58.942574191 -0700
      @@ -66,6 +66,11 @@
               SurrogateLogger.getSimpleFormat(SimpleFormatter::getLoggingProperty);
      
           /**
      +     * Create a {@code SimpleFormatter}.
      +     */
      +    public SimpleFormatter() {}
      +
      +    /**
            * Format the given LogRecord.
            * <p>
            * The formatting can be customized by specifying the format string

            darcy Joe Darcy
            darcy Joe Darcy
            Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: