JDK-8251129 : Address reliance on default constructors in the Java Beans API
  • Type: CSR
  • Component: client-libs
  • Sub-Component: java.beans
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-08-05
  • Updated: 2020-08-13
  • Resolved: 2020-08-08
Related Reports
CSR :  
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
Comments
Moving to Approved.
08-08-2020