JDK-8250223 : Address use of default constructors in java.logging
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.util.logging
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-07-23
  • Updated: 2020-07-23
  • Resolved: 2020-07-23
Related Reports
CSR :  
Description
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


Comments
Moving to Approved.
23-07-2020

Adding [~lancea] as a reviewer per https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-July/067869.html
23-07-2020