JDK-8252908 : Nested classes in Swing APIs rely on default constructors
  • Type: CSR
  • Component: client-libs
  • Sub-Component: javax.swing
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-09-08
  • Updated: 2020-09-22
  • Resolved: 2020-09-14
Related Reports
CSR :  
Description
Summary
-------

Add explicit constructors to nested protected classes of javax.swing  that have default constructors

Problem
-------

Default constructors are not recommended for classes that are parts of a formal API.

Solution
--------

Add explicit public no-arg constructors for public classes and protected no-arg constructor for public abstract classes.

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

        diff --git a/src/java.desktop/share/classes/javax/swing/AbstractButton.java b/src/java.desktop/share/classes/javax/swing/AbstractButton.java
    index ab3c1a6e935..56ff09c2c49 100644
    --- a/src/java.desktop/share/classes/javax/swing/AbstractButton.java
    +++ b/src/java.desktop/share/classes/javax/swing/AbstractButton.java
    @@ -2356,6 +2356,11 @@ public void itemStateChanged(ItemEvent event) {
             extends AccessibleJComponent implements AccessibleAction,
             AccessibleValue, AccessibleText, AccessibleExtendedComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleAbstractButton() {}
    +
             /**
              * Returns the accessible name of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/Box.java b/src/java.desktop/share/classes/javax/swing/Box.java
    index 9db52ce9a0e..552300a2008 100644
    --- a/src/java.desktop/share/classes/javax/swing/Box.java
    +++ b/src/java.desktop/share/classes/javax/swing/Box.java
    @@ -383,6 +383,11 @@ public AccessibleContext getAccessibleContext() {
              */
             @SuppressWarnings("serial")
             protected class AccessibleBoxFiller extends AccessibleAWTComponent {
    +            /**
    +             * Constructor for subclasses to call.
    +             */
    +            protected AccessibleBoxFiller() {}
    +
                 // AccessibleContext methods
                 //
                 /**
    @@ -425,6 +430,11 @@ public AccessibleContext getAccessibleContext() {
          */
         @SuppressWarnings("serial")
         protected class AccessibleBox extends AccessibleAWTContainer {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleBox() {}
    +
             // AccessibleContext methods
             //
             /**
    diff --git a/src/java.desktop/share/classes/javax/swing/CellRendererPane.java b/src/java.desktop/share/classes/javax/swing/CellRendererPane.java
    index f53a1e89b87..f5db762d760 100644
    --- a/src/java.desktop/share/classes/javax/swing/CellRendererPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/CellRendererPane.java
    @@ -244,6 +244,11 @@ public AccessibleContext getAccessibleContext() {
          * <code>CellRendererPane</code> class.
          */
         protected class AccessibleCellRendererPane extends AccessibleAWTContainer {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleCellRendererPane() {}
    +
             // AccessibleContext methods
             //
             /**
    diff --git a/src/java.desktop/share/classes/javax/swing/DefaultCellEditor.java b/src/java.desktop/share/classes/javax/swing/DefaultCellEditor.java
    index d8d9af91b9c..1cd40fc4bfa 100644
    --- a/src/java.desktop/share/classes/javax/swing/DefaultCellEditor.java
    +++ b/src/java.desktop/share/classes/javax/swing/DefaultCellEditor.java
    @@ -303,6 +303,11 @@ public Component getTableCellEditorComponent(JTable table, Object value,
             /**  The value of this cell. */
             protected Object value;
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected EditorDelegate() {}
    +
            /**
             * Returns the value of this cell.
             * @return the value of this cell
    diff --git a/src/java.desktop/share/classes/javax/swing/ImageIcon.java b/src/java.desktop/share/classes/javax/swing/ImageIcon.java
    index fd0387c5ff4..da3f6bedeac 100644
    --- a/src/java.desktop/share/classes/javax/swing/ImageIcon.java
    +++ b/src/java.desktop/share/classes/javax/swing/ImageIcon.java
    @@ -596,6 +596,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleImageIcon extends AccessibleContext
             implements AccessibleIcon, Serializable {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleImageIcon() {}
    +
             /*
              * AccessibleContest implementation -----------------
              */
    diff --git a/src/java.desktop/share/classes/javax/swing/JApplet.java b/src/java.desktop/share/classes/javax/swing/JApplet.java
    index 8d9e1b21d2b..7770056b9b9 100644
    --- a/src/java.desktop/share/classes/javax/swing/JApplet.java
    +++ b/src/java.desktop/share/classes/javax/swing/JApplet.java
    @@ -566,6 +566,11 @@ public AccessibleContext getAccessibleContext() {
          * <code>JApplet</code> class.
          */
         protected class AccessibleJApplet extends AccessibleApplet {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJApplet() {}
    +
             // everything moved to new parent, AccessibleApplet
         }
     }
    diff --git a/src/java.desktop/share/classes/javax/swing/JButton.java b/src/java.desktop/share/classes/javax/swing/JButton.java
    index f2008407610..20ef56a9f16 100644
    --- a/src/java.desktop/share/classes/javax/swing/JButton.java
    +++ b/src/java.desktop/share/classes/javax/swing/JButton.java
    @@ -301,6 +301,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial")
         protected class AccessibleJButton extends AccessibleAbstractButton {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJButton() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JCheckBox.java b/src/java.desktop/share/classes/javax/swing/JCheckBox.java
    index 3d2eefd1937..3e6634a8711 100644
    --- a/src/java.desktop/share/classes/javax/swing/JCheckBox.java
    +++ b/src/java.desktop/share/classes/javax/swing/JCheckBox.java
    @@ -332,6 +332,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJCheckBox extends AccessibleJToggleButton {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJCheckBox() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java b/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java
    index 4bc65f8eb86..24d6dd1cec9 100644
    --- a/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java
    +++ b/src/java.desktop/share/classes/javax/swing/JCheckBoxMenuItem.java
    @@ -304,6 +304,11 @@ public AccessibleContext getAccessibleContext() {
          */
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJCheckBoxMenuItem extends AccessibleJMenuItem {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJCheckBoxMenuItem() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JColorChooser.java b/src/java.desktop/share/classes/javax/swing/JColorChooser.java
    index 53eea9edd06..83e1a7e4587 100644
    --- a/src/java.desktop/share/classes/javax/swing/JColorChooser.java
    +++ b/src/java.desktop/share/classes/javax/swing/JColorChooser.java
    @@ -599,6 +599,11 @@ public AccessibleContext getAccessibleContext() {
          */
         protected class AccessibleJColorChooser extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJColorChooser() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JComponent.java b/src/java.desktop/share/classes/javax/swing/JComponent.java
    index c130afd6603..d835ec619e1 100644
    --- a/src/java.desktop/share/classes/javax/swing/JComponent.java
    +++ b/src/java.desktop/share/classes/javax/swing/JComponent.java
    @@ -3710,6 +3710,10 @@ protected AccessibleJComponent() {
              */
             protected class AccessibleContainerHandler
                 implements ContainerListener {
    +            /**
    +             * Constructor for subclasses to call.
    +             */
    +            protected AccessibleContainerHandler() {}
                 public void componentAdded(ContainerEvent e) {
                     Component c = e.getChild();
                     if (c != null && c instanceof Accessible) {
    @@ -3738,6 +3742,10 @@ public void componentRemoved(ContainerEvent e) {
              */
             @Deprecated
             protected class AccessibleFocusHandler implements FocusListener {
    +           /**
    +            * Constructor for subclasses to call.
    +            */
    +           protected AccessibleFocusHandler() {}
                public void focusGained(FocusEvent event) {
                    if (accessibleContext != null) {
                         accessibleContext.firePropertyChange(
    diff --git a/src/java.desktop/share/classes/javax/swing/JDesktopPane.java b/src/java.desktop/share/classes/javax/swing/JDesktopPane.java
    index 6bf5d5e4814..0c5f488fbe4 100644
    --- a/src/java.desktop/share/classes/javax/swing/JDesktopPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JDesktopPane.java
    @@ -627,6 +627,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJDesktopPane extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJDesktopPane() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JDialog.java b/src/java.desktop/share/classes/javax/swing/JDialog.java
    index 0cf46f45430..147bb723d6c 100644
    --- a/src/java.desktop/share/classes/javax/swing/JDialog.java
    +++ b/src/java.desktop/share/classes/javax/swing/JDialog.java
    @@ -1238,6 +1238,11 @@ public AccessibleContext getAccessibleContext() {
          */
         protected class AccessibleJDialog extends AccessibleAWTDialog {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJDialog() {}
    +
             // AccessibleContext methods
             //
             /**
    diff --git a/src/java.desktop/share/classes/javax/swing/JEditorPane.java b/src/java.desktop/share/classes/javax/swing/JEditorPane.java
    index 3facbcbf0c9..d222460e7de 100644
    --- a/src/java.desktop/share/classes/javax/swing/JEditorPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JEditorPane.java
    @@ -1659,6 +1659,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJEditorPane extends AccessibleJTextComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJEditorPane() {}
    +
             /**
              * Gets the accessibleDescription property of this object.  If this
              * property isn't set, returns the content type of this
    diff --git a/src/java.desktop/share/classes/javax/swing/JFileChooser.java b/src/java.desktop/share/classes/javax/swing/JFileChooser.java
    index 65069d39456..16c52873b0c 100644
    --- a/src/java.desktop/share/classes/javax/swing/JFileChooser.java
    +++ b/src/java.desktop/share/classes/javax/swing/JFileChooser.java
    @@ -2041,6 +2041,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Superclass is not serializable across versions
         protected class AccessibleJFileChooser extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJFileChooser() {}
    +
             /**
              * Gets the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JFrame.java b/src/java.desktop/share/classes/javax/swing/JFrame.java
    index dc24e577001..a25b1a31a49 100644
    --- a/src/java.desktop/share/classes/javax/swing/JFrame.java
    +++ b/src/java.desktop/share/classes/javax/swing/JFrame.java
    @@ -882,6 +882,11 @@ public AccessibleContext getAccessibleContext() {
          */
         protected class AccessibleJFrame extends AccessibleAWTFrame {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJFrame() {}
    +
             // AccessibleContext methods
             /**
              * Get the accessible name of this object.
    diff --git a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java
    index 51cefb0c499..a8515fe0a5d 100644
    --- a/src/java.desktop/share/classes/javax/swing/JInternalFrame.java
    +++ b/src/java.desktop/share/classes/javax/swing/JInternalFrame.java
    @@ -2011,6 +2011,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleJInternalFrame extends AccessibleJComponent
             implements AccessibleValue {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJInternalFrame() {}
    +
             /**
              * Get the accessible name of this object.
              *
    @@ -2302,6 +2307,11 @@ public AccessibleContext getAccessibleContext() {
             protected class AccessibleJDesktopIcon extends AccessibleJComponent
                 implements AccessibleValue {
     
    +            /**
    +             * Constructor for subclasses to call.
    +             */
    +            protected AccessibleJDesktopIcon() {}
    +
                 /**
                  * Gets the role of this object.
                  *
    diff --git a/src/java.desktop/share/classes/javax/swing/JLabel.java b/src/java.desktop/share/classes/javax/swing/JLabel.java
    index 0bef45440fa..efe31468859 100644
    --- a/src/java.desktop/share/classes/javax/swing/JLabel.java
    +++ b/src/java.desktop/share/classes/javax/swing/JLabel.java
    @@ -1043,6 +1043,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleJLabel extends AccessibleJComponent
             implements AccessibleText, AccessibleExtendedComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJLabel() {}
    +
             /**
              * Get the accessible name of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JLayeredPane.java b/src/java.desktop/share/classes/javax/swing/JLayeredPane.java
    index 94f409b4ba5..b42479546db 100644
    --- a/src/java.desktop/share/classes/javax/swing/JLayeredPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JLayeredPane.java
    @@ -766,6 +766,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial")
         protected class AccessibleJLayeredPane extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJLayeredPane() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JMenu.java b/src/java.desktop/share/classes/javax/swing/JMenu.java
    index 58c244b6710..9da984684e9 100644
    --- a/src/java.desktop/share/classes/javax/swing/JMenu.java
    +++ b/src/java.desktop/share/classes/javax/swing/JMenu.java
    @@ -1395,6 +1395,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleJMenu extends AccessibleJMenuItem
             implements AccessibleSelection {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJMenu() {}
    +
             /**
              * Returns the number of accessible children in the object.  If all
              * of the children of this object implement Accessible, than this
    diff --git a/src/java.desktop/share/classes/javax/swing/JMenuBar.java b/src/java.desktop/share/classes/javax/swing/JMenuBar.java
    index 81f1fb2b559..27f58de299a 100644
    --- a/src/java.desktop/share/classes/javax/swing/JMenuBar.java
    +++ b/src/java.desktop/share/classes/javax/swing/JMenuBar.java
    @@ -510,6 +510,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleJMenuBar extends AccessibleJComponent
             implements AccessibleSelection {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJMenuBar() {}
    +
             /**
              * Get the accessible state set of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/src/java.desktop/share/classes/javax/swing/JOptionPane.java
    index 666e2a05119..a5367b42f8c 100644
    --- a/src/java.desktop/share/classes/javax/swing/JOptionPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JOptionPane.java
    @@ -2547,6 +2547,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJOptionPane extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJOptionPane() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JPanel.java b/src/java.desktop/share/classes/javax/swing/JPanel.java
    index 9fe307c30db..6467f3d5489 100644
    --- a/src/java.desktop/share/classes/javax/swing/JPanel.java
    +++ b/src/java.desktop/share/classes/javax/swing/JPanel.java
    @@ -232,6 +232,10 @@ public AccessibleContext getAccessibleContext() {
          */
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJPanel extends AccessibleJComponent {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJPanel() {}
     
             /**
              * Get the role of this object.
    diff --git a/src/java.desktop/share/classes/javax/swing/JPasswordField.java b/src/java.desktop/share/classes/javax/swing/JPasswordField.java
    index 4d81295b6c5..40faaad88e9 100644
    --- a/src/java.desktop/share/classes/javax/swing/JPasswordField.java
    +++ b/src/java.desktop/share/classes/javax/swing/JPasswordField.java
    @@ -406,6 +406,11 @@ public AccessibleContext getAccessibleContext() {
          */
         protected class AccessibleJPasswordField extends AccessibleJTextField {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJPasswordField() {}
    +
             /**
              * Gets the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JProgressBar.java b/src/java.desktop/share/classes/javax/swing/JProgressBar.java
    index 7d391288569..2635298772b 100644
    --- a/src/java.desktop/share/classes/javax/swing/JProgressBar.java
    +++ b/src/java.desktop/share/classes/javax/swing/JProgressBar.java
    @@ -1011,6 +1011,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleJProgressBar extends AccessibleJComponent
             implements AccessibleValue {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJProgressBar() {}
    +
             /**
              * Gets the state set of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JRadioButton.java b/src/java.desktop/share/classes/javax/swing/JRadioButton.java
    index c85573c87ec..75880d11f97 100644
    --- a/src/java.desktop/share/classes/javax/swing/JRadioButton.java
    +++ b/src/java.desktop/share/classes/javax/swing/JRadioButton.java
    @@ -285,6 +285,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJRadioButton extends AccessibleJToggleButton {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJRadioButton() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java b/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java
    index 13953db6b48..bfddd2e45d8 100644
    --- a/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java
    +++ b/src/java.desktop/share/classes/javax/swing/JRadioButtonMenuItem.java
    @@ -278,6 +278,11 @@ public AccessibleContext getAccessibleContext() {
          */
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJRadioButtonMenuItem extends AccessibleJMenuItem {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJRadioButtonMenuItem() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JRootPane.java b/src/java.desktop/share/classes/javax/swing/JRootPane.java
    index 6275219a101..556e298b2ad 100644
    --- a/src/java.desktop/share/classes/javax/swing/JRootPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JRootPane.java
    @@ -847,6 +847,11 @@ protected void addImpl(Component comp, Object constraints, int index) {
         @SuppressWarnings("serial")
         protected class RootLayout implements LayoutManager2, Serializable
         {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected RootLayout() {}
    +
             /**
              * Returns the amount of space the layout would like to have.
              *
    @@ -1012,6 +1017,11 @@ public AccessibleContext getAccessibleContext() {
          */
         @SuppressWarnings("serial")
         protected class AccessibleJRootPane extends AccessibleJComponent {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJRootPane() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JScrollBar.java b/src/java.desktop/share/classes/javax/swing/JScrollBar.java
    index 6fb1f3df50f..3281a0d8fa7 100644
    --- a/src/java.desktop/share/classes/javax/swing/JScrollBar.java
    +++ b/src/java.desktop/share/classes/javax/swing/JScrollBar.java
    @@ -855,6 +855,11 @@ public AccessibleContext getAccessibleContext() {
         protected class AccessibleJScrollBar extends AccessibleJComponent
             implements AccessibleValue {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJScrollBar() {}
    +
             /**
              * Get the state set of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JSeparator.java b/src/java.desktop/share/classes/javax/swing/JSeparator.java
    index 4b44496d624..b678bfc96e2 100644
    --- a/src/java.desktop/share/classes/javax/swing/JSeparator.java
    +++ b/src/java.desktop/share/classes/javax/swing/JSeparator.java
    @@ -277,6 +277,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial")
         protected class AccessibleJSeparator extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJSeparator() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JSplitPane.java b/src/java.desktop/share/classes/javax/swing/JSplitPane.java
    index 517562fa817..6b013cceb05 100644
    --- a/src/java.desktop/share/classes/javax/swing/JSplitPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JSplitPane.java
    @@ -1135,6 +1135,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJSplitPane extends AccessibleJComponent
             implements AccessibleValue {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJSplitPane() {}
    +
             /**
              * Gets the state set of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JTabbedPane.java b/src/java.desktop/share/classes/javax/swing/JTabbedPane.java
    index c1810554845..8e3146daab3 100644
    --- a/src/java.desktop/share/classes/javax/swing/JTabbedPane.java
    +++ b/src/java.desktop/share/classes/javax/swing/JTabbedPane.java
    @@ -289,6 +289,11 @@ public String getUIClassID() {
          * the tabbedpane (instead of the model itself) as the event source.
          */
         protected class ModelListener implements ChangeListener, Serializable {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected ModelListener() {}
    +
             public void stateChanged(ChangeEvent e) {
                 fireStateChanged();
             }
    diff --git a/src/java.desktop/share/classes/javax/swing/JTextArea.java b/src/java.desktop/share/classes/javax/swing/JTextArea.java
    index 4b9ba807e63..e370aade002 100644
    --- a/src/java.desktop/share/classes/javax/swing/JTextArea.java
    +++ b/src/java.desktop/share/classes/javax/swing/JTextArea.java
    @@ -783,6 +783,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJTextArea extends AccessibleJTextComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJTextArea() {}
    +
             /**
              * Gets the state set of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JTextField.java b/src/java.desktop/share/classes/javax/swing/JTextField.java
    index c54cef64217..fc4a492c6d0 100644
    --- a/src/java.desktop/share/classes/javax/swing/JTextField.java
    +++ b/src/java.desktop/share/classes/javax/swing/JTextField.java
    @@ -950,6 +950,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJTextField extends AccessibleJTextComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJTextField() {}
    +
             /**
              * Gets the state set of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JToolBar.java b/src/java.desktop/share/classes/javax/swing/JToolBar.java
    index e503e0788aa..7c2fef9d8c5 100644
    --- a/src/java.desktop/share/classes/javax/swing/JToolBar.java
    +++ b/src/java.desktop/share/classes/javax/swing/JToolBar.java
    @@ -831,6 +831,11 @@ public AccessibleContext getAccessibleContext() {
          */
         protected class AccessibleJToolBar extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJToolBar() {}
    +
             /**
              * Get the state of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JToolTip.java b/src/java.desktop/share/classes/javax/swing/JToolTip.java
    index 3ae2d100e89..817200fec1f 100644
    --- a/src/java.desktop/share/classes/javax/swing/JToolTip.java
    +++ b/src/java.desktop/share/classes/javax/swing/JToolTip.java
    @@ -261,6 +261,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial")
         protected class AccessibleJToolTip extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJToolTip() {}
    +
             /**
              * Get the accessible description of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JTree.java b/src/java.desktop/share/classes/javax/swing/JTree.java
    index 1548ecc6e59..810bea55b5f 100644
    --- a/src/java.desktop/share/classes/javax/swing/JTree.java
    +++ b/src/java.desktop/share/classes/javax/swing/JTree.java
    @@ -3320,6 +3320,11 @@ private TreePath getPathForIndexs(int[] indexs) {
         protected static class EmptySelectionModel extends
                   DefaultTreeSelectionModel
         {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected EmptySelectionModel() {}
    +
             /**
              * The single instance of {@code EmptySelectionModel}.
              */
    @@ -3442,6 +3447,11 @@ public void removePropertyChangeListener(
         protected class TreeSelectionRedirector implements Serializable,
                         TreeSelectionListener
         {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected TreeSelectionRedirector() {}
    +
             /**
              * Invoked by the <code>TreeSelectionModel</code> when the
              * selection changes.
    @@ -3863,6 +3873,11 @@ void removeDescendantSelectedPaths(TreeModelEvent e) {
           * accordingly when nodes are removed, or changed.
           */
         protected class TreeModelHandler implements TreeModelListener {
    +         /**
    +          * Constructor for subclasses to call.
    +          */
    +         protected TreeModelHandler() {}
    +
             public void treeNodesChanged(TreeModelEvent e) { }
     
             public void treeNodesInserted(TreeModelEvent e) { }
    diff --git a/src/java.desktop/share/classes/javax/swing/JViewport.java b/src/java.desktop/share/classes/javax/swing/JViewport.java
    index 14fdf3b57d1..ac2cfd74701 100644
    --- a/src/java.desktop/share/classes/javax/swing/JViewport.java
    +++ b/src/java.desktop/share/classes/javax/swing/JViewport.java
    @@ -1405,6 +1405,11 @@ public void setExtentSize(Dimension newExtent) {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class ViewListener extends ComponentAdapter implements Serializable
         {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected ViewListener() {}
    +
             public void componentResized(ComponentEvent e) {
                 fireStateChanged();
                 revalidate();
    @@ -1875,6 +1880,12 @@ public AccessibleContext getAccessibleContext() {
          */
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJViewport extends AccessibleJComponent {
    +
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJViewport() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/JWindow.java b/src/java.desktop/share/classes/javax/swing/JWindow.java
    index 7db6227dca4..7ca38702353 100644
    --- a/src/java.desktop/share/classes/javax/swing/JWindow.java
    +++ b/src/java.desktop/share/classes/javax/swing/JWindow.java
    @@ -654,6 +654,10 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial")
         protected class AccessibleJWindow extends AccessibleAWTWindow {
             // everything is in the new parent, AccessibleAWTWindow
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJWindow() {}
         }
     
     }
    diff --git a/src/java.desktop/share/classes/javax/swing/ToolTipManager.java b/src/java.desktop/share/classes/javax/swing/ToolTipManager.java
    index 19664c584b6..b0b179b9c7b 100644
    --- a/src/java.desktop/share/classes/javax/swing/ToolTipManager.java
    +++ b/src/java.desktop/share/classes/javax/swing/ToolTipManager.java
    @@ -677,6 +677,11 @@ private void checkForTipChange(MouseEvent event) {
          * Inside timer action.
          */
         protected class insideTimerAction implements ActionListener {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected insideTimerAction() {}
    +
             /**
              * {@inheritDoc}
              */
    @@ -707,6 +712,11 @@ public void actionPerformed(ActionEvent e) {
          * Outside timer action.
          */
         protected class outsideTimerAction implements ActionListener {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected outsideTimerAction() {}
    +
             /**
              * {@inheritDoc}
              */
    @@ -719,6 +729,11 @@ public void actionPerformed(ActionEvent e) {
          * Still inside timer action.
          */
         protected class stillInsideTimerAction implements ActionListener {
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected stillInsideTimerAction() {}
    +
             /**
              * {@inheritDoc}
              */
    diff --git a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java
    index 942d2cc30dc..504e9078f1a 100644
    --- a/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java
    +++ b/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java
    @@ -808,6 +808,11 @@ public AccessibleContext getAccessibleContext() {
         @SuppressWarnings("serial") // Same-version serialization only
         protected class AccessibleJTableHeader extends AccessibleJComponent {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected AccessibleJTableHeader() {}
    +
             /**
              * Get the role of this object.
              *
    diff --git a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java
    index a7d85bf8122..4ce1c795258 100644
    --- a/src/java.desktop/share/classes/javax/swing/text/html/FormView.java
    +++ b/src/java.desktop/share/classes/javax/swing/text/html/FormView.java
    @@ -552,6 +552,11 @@ private void storePostData(HTMLDocument doc, String target, String data) {
          */
         protected class MouseEventListener extends MouseAdapter {
     
    +        /**
    +         * Constructor for subclasses to call.
    +         */
    +        protected MouseEventListener() {}
    +
             public void mouseReleased(MouseEvent evt) {
                 String imageData = getImageData(evt.getPoint());
                 imageSubmit(imageData);



Comments
[~serb], upon closer inspection, you are correct that a protected constructor in a protected class can be directly called. (It is more common to see protected constructors in public abstract classes where this is not the case.) I agree it would be preferable to use a different wording like "Constructs a Foo" in this case. Sorry for not recognizing this nuance earlier.
22-09-2020

[~darcy] Nope, the protected constructors in non-abstract classes can be called directly. For example "AccessibleBox" the protected inner class, now it has a "protected" constructor: https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/Box.java#L437 which is called directly in the outer class: https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/Box.java#L423
18-09-2020

A protected constructor is called by subclasses.
17-09-2020

I still disagreed that the "Constructor for subclasses to call" is a correct JavaDoc for non-abstract classes.
14-09-2020

Moving to Approved.
14-09-2020

The comment copied from the PR: These classes are not abstract so not sure about the spec for the constructor: "Constructor for subclasses to call." Some of them like "AccessibleBox" is instantiated directly. I guess we need to follow the "Constructs XXX" pattern here.
10-09-2020

https://github.com/openjdk/jdk/pull/72
10-09-2020

I'm not exactly sure about meaning of "diff noise" but if it is referring to these lines diff --git a/src/java.desktop/share/classes/javax/swing/JOptionPane.java b/src/java I actually follow the same template for all the CSRs of the 4-5 constructors issue. I "select all" the .diff file (earlier open.patch from webrev) and paste it here which is easier. Otherwise it will be selective copy which can be tedious, or maybe selective delete after copying it here.
10-09-2020

I'm not a big fan of all the diff noise in the specification so I'd prefer you clean it up, but spec. wise it is OK
09-09-2020