JDK-8253054 : Address reliance on default constructors in the Accessibility APIs
  • Type: CSR
  • Component: client-libs
  • Sub-Component: javax.accessibility
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-09-11
  • Updated: 2020-09-21
  • Resolved: 2020-09-21
Related Reports
CSR :  
Description
Summary
-------

Address the reliance on default constructors in several classes in the java Accessibility APIs.

Problem
-------

Several classes in the Accessibility APIs rely on the use of implicit Default Constructors. This is unsuitable as certain access modifiers are required for some constructors and API descriptions but are not included with the use of implicit Default Constructors. The use of explicitly defined no-arg constructors is required.

Solution
--------

The following classes have had an explicit no-arg constructor added, with a protected access modifier and accompanying API description:

 - Default ctor on com.sun.java.accessibility.util.SwingEventMonitor
 - Default ctor on javax.accessibility.AccessibleContext 
 - Default ctor on javax.accessibility.AccessibleHyperlink

The following classes have had an explicit no-arg constructor added, with a public access modifier and accompanying API description:

 - Default ctor on javax.accessibility.AccessibleResourceBundle
 - Default ctor on com.sun.java.accessibility.util.AWTEventMonitor
 - Default ctor on com.sun.java.accessibility.util.AccessibilityEventMonitor
 - Default ctor on com.sun.java.accessibility.util.AccessibilityListenerList
 - Default ctor on com.sun.java.accessibility.util.EventID


Specification
-------------

    --- old/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java	2020-09-11 14:28:28.272541092 +0100
    +++ new/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java	2020-09-11 14:28:27.924546066 +0100
    @@ -80,6 +80,11 @@
     public abstract class AccessibleContext {
     
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    protected AccessibleContext() {}
    +
    +    /**
          * The {@code AppContext} that should be used to dispatch events for this
          * {@code AccessibleContext}.
          */
    --- old/src/java.desktop/share/classes/javax/accessibility/AccessibleHyperlink.java	2020-09-11 14:28:28.880532400 +0100
    +++ new/src/java.desktop/share/classes/javax/accessibility/AccessibleHyperlink.java	2020-09-11 14:28:28.572536803 +0100
    @@ -39,6 +39,11 @@
     public abstract class AccessibleHyperlink implements AccessibleAction {
     
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    protected AccessibleHyperlink() {}
    +
    +    /**
          * Since the document a link is associated with may have changed, this
          * method returns whether or not this Link is still valid (with respect to
          * the document it references).
    --- old/src/java.desktop/share/classes/javax/accessibility/AccessibleResourceBundle.java	2020-09-11 14:28:29.500523538 +0100
    +++ new/src/java.desktop/share/classes/javax/accessibility/AccessibleResourceBundle.java	2020-09-11 14:28:29.180528112 +0100
    @@ -39,6 +39,11 @@
     public class AccessibleResourceBundle extends ListResourceBundle {
     
         /**
    +     * Constructs an {@code AccessibleResourceBundle}.
    +     */
    +    public AccessibleResourceBundle() {}
    +
    +    /**
          * Returns the mapping between the programmatic keys and the localized
          * display strings.
          *
    --- old/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java	2020-09-11 14:28:30.116514735 +0100
    +++ new/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java	2020-09-11 14:28:29.788519422 +0100
    @@ -46,6 +46,11 @@
     public class AWTEventMonitor {
     
         /**
    +     * Constructs an {@code AWTEventMonitor}.
    +     */
    +    public AWTEventMonitor() {}
    +
    +    /**
          * The current component with keyboard focus.
          *
          * @see #getComponentWithFocus
    --- old/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java	2020-09-11 14:28:30.780505245 +0100
    +++ new/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java	2020-09-11 14:28:30.432510218 +0100
    @@ -45,6 +45,11 @@
     
     public class AccessibilityEventMonitor {
     
    +    /**
    +     * Constructs an {@code AccessibilityEventMonitor}.
    +     */
    +    public AccessibilityEventMonitor() {}
    +
         // listeners
         /**
          * The current list of registered {@link java.beans.PropertyChangeListener
    --- old/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityListenerList.java	2020-09-11 14:28:31.396496442 +0100
    +++ new/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityListenerList.java	2020-09-11 14:28:31.084500901 +0100
    @@ -47,6 +47,11 @@
         protected transient Object[] listenerList = NULL_ARRAY;
     
         /**
    +     * Constructs an {@code AccessibilityListenerList}.
    +     */
    +    public AccessibilityListenerList() {}
    +
    +    /**
          * Passes back the event listener list as an array of listener type, listener pairs.
          * Note that for performance reasons, this implementation passes back the actual
          * data structure in which the listener data is stored internally. This method
    --- old/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/EventID.java	2020-09-11 14:28:32.008487697 +0100
    +++ new/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/EventID.java	2020-09-11 14:28:31.700492098 +0100
    @@ -38,6 +38,11 @@
     public class EventID {
     
         /**
    +     * Constructs an {@code EventID}.
    +     */
    +    public EventID() {}
    +
    +    /**
          * Maps to AWT Action support (i.e., ActionListener and ActionEvent)
          */
         static public final int ACTION              = 0;

A zip of the API specification changes is added in the CSR attachments. The API documentation changes can also be browsed at the following place for reviewer���s convenience: http://cr.openjdk.java.net/~ccleary/issues/webrevs-store/8250859/webrevs/webrev.00/specdiff/overview-summary.html

Comments
Moving to Approved.
21-09-2020

Looks fine; moving to Provisional.
15-09-2020

I set "scope" to "SE" but the com.sun ones are JDK not SE. Please put all the updates IN-LINE in the spec section and split them and call out which ones are SE and which are JDK.
15-09-2020