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

Address reliance on default constructors in the Accessibility APIs

    XMLWordPrintable

    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

      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

        Attachments

        1. diff.patch
          6 kB
        2. specdiff.zip
          1.85 MB

          Issue Links

            Activity

              People

              Assignee:
              ccleary Conor Cleary (Inactive)
              Reporter:
              prr Philip Race
              Reviewed By:
              Philip Race
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: