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

Address reliance on default constructors in the Java Beans API

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 16
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add explicit constructors to some classes in Java Beans APIs which using default constructors.

      Problem

      Default constructors are not recommended for formal API classes.

      Solution

      Add the public constructors to the public/non-abstract classes, and protected constructors to the public/abstract classes.

      Specification

      src/java.desktop/share/classes/java/beans/Beans.java
          public class Beans {
      
      +    /**
      +     * Constructs a {@code Beans}.
      +     */
      +    public Beans() {}
      
      src/java.desktop/share/classes/java/beans/Encoder.java
      
      +    /**
      +     * Constructs an {@code Encoder}.
      +     */
      +    public Encoder() {}
      
      src/java.desktop/share/classes/java/beans/PersistenceDelegate.java
          public abstract class PersistenceDelegate {
      
      +    /**
      +     * Constructs a {@code PersistenceDelegate}.
      +     */
      +    protected PersistenceDelegate() {}
      
      src/java.desktop/share/classes/java/beans/PropertyEditorManager.java
          public class PropertyEditorManager {
      
      +    /**
      +     * Constructs a {@code PropertyEditorManager}.
      +     */
      +    public PropertyEditorManager() {}
      
      src/java.desktop/share/classes/java/beans/SimpleBeanInfo.java   
          public class SimpleBeanInfo implements BeanInfo {
      
      +    /**
      +     * Constructs a {@code SimpleBeanInfo}.
      +     */
      +    public SimpleBeanInfo() {}

      Link for convenience: http://cr.openjdk.java.net/~serb/8250857/webrev.00

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serb Sergey Bylokhov
                Reporter:
                prr Philip Race
                Reviewed By:
                Philip Race
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: