JDK-8250812 : Address reliance on default constructors in the javax.swing.plaf.multi module
  • Type: CSR
  • Component: client-libs
  • Sub-Component: javax.swing
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-07-30
  • Updated: 2020-08-13
  • Resolved: 2020-08-09
Related Reports
CSR :  
Description
Summary
-------
Add explicit constructors to API classes of javax.swing.plaf.multi that have default constructors.

Problem
-------

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

Solution
--------

Add explicit no-arg constructors. 

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


    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiButtonUI.java	2020-07-30 13:02:15.589221000 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiButtonUI.java	2020-07-30 13:02:13.104572500 +0530
    @@ -42,6 +42,11 @@
     public class MultiButtonUI extends ButtonUI {
 
         /**
    +     * Constructs a {@code MultiButtonUI}.
    +     */
    +    public MultiButtonUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java	2020-07-30 13:02:30.680629300 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiColorChooserUI.java	2020-07-30 13:02:28.447541900 +0530
    @@ -42,6 +42,11 @@
     public class MultiColorChooserUI extends ColorChooserUI {
 
           /**
    +     * Constructs a {@code MultiColorChooserUI}.
    +     */
    +    public MultiColorChooserUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java	2020-07-30 13:02:49.482705600 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiComboBoxUI.java	2020-07-30 13:02:46.152954800 +0530
    @@ -43,6 +43,11 @@
     public class MultiComboBoxUI extends ComboBoxUI {
 
         /**
    +     * Constructs a {@code MultiComboBoxUI}.
    +     */
    +    public MultiComboBoxUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java	2020-07-30 13:03:08.573646700 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiDesktopIconUI.java	2020-07-30 13:03:05.003005400 +0530
    @@ -42,6 +42,11 @@
     public class MultiDesktopIconUI extends DesktopIconUI {
 
         /**
    +     * Constructs a {@code MultiDesktopIconUI}.
    +     */
    +    public MultiDesktopIconUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java	2020-07-30 13:03:29.872501500 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiDesktopPaneUI.java	2020-07-30 13:03:26.167893100 +0530
    @@ -42,6 +42,11 @@
     public class MultiDesktopPaneUI extends DesktopPaneUI {
 
         /**
    +     * Constructs a {@code MultiDesktopPaneUI}.
    +     */
    +    public MultiDesktopPaneUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java	2020-07-30 13:03:46.833804700 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiFileChooserUI.java	2020-07-30 13:03:44.166115500 +0530
    @@ -47,6 +47,11 @@
     public class MultiFileChooserUI extends FileChooserUI {
 
         /**
    +     * Constructs a {@code MultiFileChooserUI}.
    +     */
    +    public MultiFileChooserUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java	2020-07-30 13:04:02.842260200 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiInternalFrameUI.java	2020-07-30 13:04:00.504251600 +0530
    @@ -42,6 +42,11 @@
     public class MultiInternalFrameUI extends InternalFrameUI {
 
         /**
    +     * Constructs a {@code MultiInternalFrameUI}.
    +     */
    +    public MultiInternalFrameUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiLabelUI.java	2020-07-30 13:04:15.614559300 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiLabelUI.java	2020-07-30 13:04:13.501854400 +0530
    @@ -42,6 +42,11 @@
     public class MultiLabelUI extends LabelUI {
 
         /**
    +     * Constructs a {@code MultiLabelUI}.
    +     */
    +    public MultiLabelUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiListUI.java	2020-07-30 13:04:28.581337600 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiListUI.java	2020-07-30 13:04:26.381229400 +0530
    @@ -45,6 +45,11 @@
     public class MultiListUI extends ListUI {
 
         /**
    +     * Constructs a {@code MultiListUI}.
    +     */
    +    public MultiListUI() {}
    +
    +    /**
      * The vector containing the real UIs.  This is populated
      * in the call to <code>createUI</code>, and can be obtained by calling
      * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiLookAndFeel.java	2020-07-30 13:04:41.848951100 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiLookAndFeel.java	2020-07-30 13:04:39.552172400 +0530
    @@ -59,6 +59,11 @@
     @SuppressWarnings("serial") // Same-version serialization only
     public class MultiLookAndFeel extends LookAndFeel {
 
    +    /**
    +     * Constructs a {@code MultiLookAndFeel}.
    +     */
    +    public MultiLookAndFeel() {}
    +
     //////////////////////////////
     // LookAndFeel methods
     //////////////////////////////

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java	2020-07-30 13:05:00.121789500 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiMenuBarUI.java	2020-07-30 13:04:57.629549200 +0530
    @@ -42,6 +42,11 @@
     public class MultiMenuBarUI extends MenuBarUI {
 
         /**
    +     * Constructs a {@code MultiMenuBarUI}.
    +     */
    +    public MultiMenuBarUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java	2020-07-30 13:05:17.062827900 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiMenuItemUI.java	2020-07-30 13:05:14.324504000 +0530
    @@ -43,6 +43,11 @@
     public class MultiMenuItemUI extends MenuItemUI {
 
         /**
    +     * Constructs a {@code MultiMenuItemUI}.
    +     */
    +    public MultiMenuItemUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java	2020-07-30 13:05:32.447003900 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiOptionPaneUI.java	2020-07-30 13:05:29.819346100 +0530
     @@ -43,6 +43,11 @@
      public class MultiOptionPaneUI extends OptionPaneUI {
 
         /**
    +     * Constructs a {@code MultiOptionPaneUI}.
    +     */
    +    public MultiOptionPaneUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiPanelUI.java	2020-07-30 13:05:50.062008800 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiPanelUI.java	2020-07-30 13:05:46.806792100 +0530
    @@ -42,6 +42,11 @@
     public class MultiPanelUI extends PanelUI {
 
         /**
    +     * Constructs a {@code MultiPanelUI}.
    +     */
    +    public MultiPanelUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java	2020-07-30 13:06:11.049761500 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiPopupMenuUI.java	2020-07-30 13:06:05.977861400 +0530
    @@ -45,6 +45,11 @@
      public class MultiPopupMenuUI extends PopupMenuUI {
 
         /**
    +     * Constructs a {@code MultiPopupMenuUI}.
    +     */
    +    public MultiPopupMenuUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java	2020-07-30 13:06:27.268673200 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiProgressBarUI.java	2020-07-30 13:06:24.759595100 +0530
    @@ -42,6 +42,11 @@
     public class MultiProgressBarUI extends ProgressBarUI {
 
         /**
    +     * Constructs a {@code MultiProgressBarUI}.
    +     */
    +    public MultiProgressBarUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java	2020-07-30 13:06:44.277860500 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiRootPaneUI.java	2020-07-30 13:06:41.462108400 +0530
    @@ -43,6 +43,11 @@
     public class MultiRootPaneUI extends RootPaneUI {
 
         /**
     +     * Constructs a {@code MultiRootPaneUI}.
    +     */
    +    public MultiRootPaneUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java	2020-07-30 13:06:59.389560500 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiScrollBarUI.java	2020-07-30 13:06:56.763067300 +0530
    @@ -42,6 +42,11 @@
     public class MultiScrollBarUI extends ScrollBarUI {
 
         /**
    +     * Constructs a {@code MultiScrollBarUI}.
    +     */
    +    public MultiScrollBarUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java	2020-07-30 13:07:18.327146100 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiScrollPaneUI.java	2020-07-30 13:07:14.760081000 +0530
    @@ -42,6 +42,11 @@
     public class MultiScrollPaneUI extends ScrollPaneUI {
 
         /**
    +     * Constructs a {@code MultiScrollPaneUI}.
    +     */
    +    public MultiScrollPaneUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

     --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java	2020-07-30 13:07:37.552514300 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSeparatorUI.java	2020-07-30 13:07:34.452725300 +0530
    @@ -42,6 +42,11 @@
     public class MultiSeparatorUI extends SeparatorUI {
 
         /**
    +     * Constructs a {@code MultiSeparatorUI}.
    +     */
    +    public MultiSeparatorUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSliderUI.java	2020-07-30 13:07:54.004709800 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSliderUI.java	2020-07-30 13:07:51.480678100 +0530
    @@ -42,6 +42,11 @@
      public class MultiSliderUI extends SliderUI {
 
         /**
    +     * Constructs a {@code MultiSliderUI}.
    +     */
    +    public MultiSliderUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java	2020-07-30 13:08:08.275747800 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSpinnerUI.java	2020-07-30 13:08:06.003576800 +0530
    @@ -43,6 +43,11 @@
     public class MultiSpinnerUI extends SpinnerUI {
 
         /**
    +     * Constructs a {@code MultiSpinnerUI}.
    +     */
    +    public MultiSpinnerUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java	2020-07-30 13:08:26.475579200 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiSplitPaneUI.java	2020-07-30 13:08:24.219814800 +0530
    @@ -43,6 +43,11 @@
     public class MultiSplitPaneUI extends SplitPaneUI {
 
         /**
    +     * Constructs a {@code MultiSplitPaneUI}.
    +     */
    +    public MultiSplitPaneUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java	2020-07-30 13:08:39.813910600 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTabbedPaneUI.java	2020-07-30 13:08:37.629855100 +0530
     @@ -44,6 +44,11 @@
     public class MultiTabbedPaneUI extends TabbedPaneUI {
 
         /**
    +     * Constructs a {@code MultiTabbedPaneUI}.
    +     */
    +    public MultiTabbedPaneUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java	2020-07-30 13:08:53.298489300 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTableHeaderUI.java	2020-07-30 13:08:50.775300300 +0530
    @@ -42,6 +42,11 @@
     public class MultiTableHeaderUI extends TableHeaderUI {
 
         /**
    +     * Constructs a {@code MultiTableHeaderUI}.
    +     */
    +    public MultiTableHeaderUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTableUI.java	2020-07-30 13:09:07.513196400 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTableUI.java	2020-07-30 13:09:05.043253500 +0530
    @@ -42,6 +42,11 @@
     public class MultiTableUI extends TableUI {
 
         /**
    +     * Constructs a {@code MultiTableUI}.
    +     */
    +    public MultiTableUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTextUI.java	2020-07-30 13:09:23.458337500 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTextUI.java	2020-07-30 13:09:20.973072100 +0530
    @@ -52,6 +52,11 @@
     public class MultiTextUI extends TextUI {
 
         /**
    +     * Constructs a {@code MultiTextUI}.
    +     */
    +    public MultiTextUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java	2020-07-30 13:09:40.692706900 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiToolBarUI.java	2020-07-30 13:09:38.192998700 +0530
    @@ -42,6 +42,11 @@
     public class MultiToolBarUI extends ToolBarUI {
 
         /**
    +     * Constructs a {@code MultiToolBarUI}.
    +     */
    +    public MultiToolBarUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java	2020-07-30 13:09:56.618310700 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiToolTipUI.java	2020-07-30 13:09:53.140362800 +0530
    @@ -42,6 +42,11 @@
     public class MultiToolTipUI extends ToolTipUI {
 
         /**
    +     * Constructs a {@code MultiToolTipUI}.
    +     */
    +    public MultiToolTipUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTreeUI.java	2020-07-30 13:10:14.602497700    +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiTreeUI.java	2020-07-30 13:10:11.534934500 +0530
    @@ -45,6 +45,11 @@
     public class MultiTreeUI extends TreeUI {
 
         /**
    +     * Constructs a {@code MultiTreeUI}.
    +     */
    +    public MultiTreeUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI

    --- old/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiViewportUI.java	2020-07-30 13:10:31.288016300 +0530
    +++ new/src/java.desktop/share/classes/javax/swing/plaf/multi/MultiViewportUI.java	2020-07-30 13:10:28.730606800 +0530
    @@ -42,6 +42,11 @@
     public class MultiViewportUI extends ViewportUI {
 
         /**
    +     * Constructs a {@code MultiViewportUI}.
    +     */
    +    public MultiViewportUI() {}
    +
    +    /**
          * The vector containing the real UIs.  This is populated
          * in the call to <code>createUI</code>, and can be obtained by calling
          * the <code>getUIs</code> method.  The first element is guaranteed to be the real UI




Comments
[~psadhukhan], when editing the description field, there are formatting buttons above the box. The "101 010" box does code markup to selected text.
10-08-2020

Thanks Joe. [~darcy]One basic question, how to correctly submit the "Specification" details in the CSR? When I copy the webrev.1/open.patch and pasted, it did not appear correctly and I had to manually add 4 spaces to every line to make it appear correctly. But if there are more files, it will be difficult to do manually.
10-08-2020

Moving to Approved.
09-08-2020

webrev: http://cr.openjdk.java.net/~psadhukhan/8250811/webrev.1/
07-08-2020