Summary
-------
Add explicit constructors to API classes of javax.swing.plaf.synth 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
-------------
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java 2020-08-14 11:39:59.484571000 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthButtonUI.java 2020-08-14 11:39:55.902370900 +0530
@@ -49,6 +49,11 @@
private static final Object SYNTH_BUTTON_UI_KEY = new Object();
/**
+ * Constructs a {@code SynthButtonUI}.
+ */
+ public SynthButtonUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java 2020-08-14 11:40:24.172061400 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java 2020-08-14 11:40:20.384836300 +0530
@@ -44,6 +44,12 @@
public class SynthCheckBoxMenuItemUI extends SynthMenuItemUI {
/**
+ *
+ * Constructs a {@code SynthCheckBoxMenuItemUI}.
+ */
+ public SynthCheckBoxMenuItemUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java 2020-08-14 11:40:48.756871200 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java 2020-08-14 11:40:44.190489200 +0530
@@ -39,6 +39,12 @@
*/
public class SynthCheckBoxUI extends SynthRadioButtonUI {
+ /**
+ *
+ * Constructs a {@code SynthCheckBoxUI}.
+ */
+ public SynthCheckBoxUI() {}
+
// ********************************
// Create PLAF
// ********************************
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java 2020-08-14 11:41:25.721111800 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java 2020-08-14 11:41:22.001767000 +0530
@@ -48,6 +48,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthColorChooserUI}.
+ */
+ public SynthColorChooserUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java 2020-08-14 11:41:50.256504300 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java 2020-08-14 11:41:46.726470900 +0530
@@ -93,6 +93,12 @@
private boolean forceOpaque = false;
/**
+ *
+ * Constructs a {@code SynthComboBoxUI}.
+ */
+ public SynthComboBoxUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java 2020-08-14 11:42:16.262100400 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java 2020-08-14 11:42:12.611758200 +0530
@@ -45,6 +45,12 @@
private Handler handler = new Handler();
/**
+ *
+ * Constructs a {@code SynthDesktopIconUI}.
+ */
+ public SynthDesktopIconUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java 2020-08-14 11:42:40.725788700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java 2020-08-14 11:42:36.086859100 +0530
@@ -48,6 +48,12 @@
private DesktopManager oldDesktopManager;
/**
+ *
+ * Constructs a {@code SynthDesktopPaneUI}.
+ */
+ public SynthDesktopPaneUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java 2020-08-14 11:43:03.403016800 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java 2020-08-14 11:42:59.770889500 +0530
@@ -50,6 +50,12 @@
private boolean updateKBAction = true;
/**
+ *
+ * Constructs a {@code SynthEditorPaneUI}.
+ */
+ public SynthEditorPaneUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java 2020-08-14 11:43:30.786132400 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java 2020-08-14 11:43:27.185617600 +0530
@@ -36,6 +36,12 @@
*/
public class SynthFormattedTextFieldUI extends SynthTextFieldUI {
/**
+ *
+ * Constructs a {@code SynthFormattedTextFieldUI}.
+ */
+ public SynthFormattedTextFieldUI() {}
+
+ /**
* Creates a UI for a JFormattedTextField.
*
* @param c the formatted text field
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLabelUI.java 2020-08-14 11:43:54.832500700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLabelUI.java 2020-08-14 11:43:51.065905800 +0530
@@ -47,6 +47,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthLabelUI}.
+ */
+ public SynthLabelUI() {}
+
+ /**
* Returns the LabelUI implementation used for the skins look and feel.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthListUI.java 2020-08-14 11:44:18.347895500 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthListUI.java 2020-08-14 11:44:13.379444500 +0530
@@ -47,6 +47,12 @@
private boolean useUIBorder;
/**
+ *
+ * Constructs a {@code SynthListUI}.
+ */
+ public SynthListUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param list component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java 2020-08-14 11:45:00.713966600 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java 2020-08-14 11:44:56.657713100 +0530
@@ -43,6 +43,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthMenuBarUI}.
+ */
+ public SynthMenuBarUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java 2020-08-14 11:46:06.199220700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java 2020-08-14 11:45:58.509103800 +0530
@@ -49,6 +49,12 @@
private SynthStyle accStyle;
/**
+ *
+ * Constructs a {@code SynthMenuItemUI}.
+ */
+ public SynthMenuItemUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuUI.java 2020-08-14 11:47:15.667408800 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthMenuUI.java 2020-08-14 11:47:06.879642800 +0530
@@ -46,6 +46,12 @@
private SynthStyle accStyle;
/**
+ *
+ * Constructs a {@code SynthMenuUI}.
+ */
+ public SynthMenuUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java 2020-08-14 11:48:10.169233400 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java 2020-08-14 11:48:06.207090800 +0530
@@ -46,6 +46,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthOptionPaneUI}.
+ */
+ public SynthOptionPaneUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPainter.java 2020-08-14 11:48:35.402289700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPainter.java 2020-08-14 11:48:31.995075200 +0530
@@ -65,6 +65,10 @@
*/
static SynthPainter NULL_PAINTER = new SynthPainter() {};
+ /**
+ * Constructor for subclasses to call.
+ */
+ protected SynthPainter() {}
/**
* Paints the background of an arrow button. Arrow buttons are created by
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPanelUI.java 2020-08-14 11:48:57.575558000 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPanelUI.java 2020-08-14 11:48:53.483650600 +0530
@@ -43,6 +43,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthPanelUI}.
+ */
+ public SynthPanelUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java 2020-08-14 11:49:18.778170600 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java 2020-08-14 11:49:14.774627300 +0530
@@ -40,6 +40,12 @@
public class SynthPasswordFieldUI extends SynthTextFieldUI {
/**
+ *
+ * Constructs a {@code SynthPasswordFieldUI}.
+ */
+ public SynthPasswordFieldUI() {}
+
+ /**
* Creates a UI for a JPasswordField.
*
* @param c the JPasswordField
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java 2020-08-14 11:49:40.179783900 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java 2020-08-14 11:49:35.632019700 +0530
@@ -46,6 +46,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthPopupMenuUI}.
+ */
+ public SynthPopupMenuUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java 2020-08-14 11:50:36.031648800 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java 2020-08-14 11:50:30.103149200 +0530
@@ -53,6 +53,12 @@
private int glowWidth; // Glow around the bar foreground
/**
+ *
+ * Constructs a {@code SynthProgressBarUI}.
+ */
+ public SynthProgressBarUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java 2020-08-14 11:51:10.453365200 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java 2020-08-14 11:51:05.496563500 +0530
@@ -40,6 +40,12 @@
public class SynthRadioButtonMenuItemUI extends SynthMenuItemUI {
/**
+ *
+ * Constructs a {@code SynthRadioButtonMenuItemUI}.
+ */
+ public SynthRadioButtonMenuItemUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param b component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java 2020-08-14 11:51:50.670139000 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java 2020-08-14 11:51:46.566181300 +0530
@@ -37,6 +37,11 @@
* @since 1.7
*/
public class SynthRadioButtonUI extends SynthToggleButtonUI {
+ /**
+ *
+ * Constructs a {@code SynthRadioButtonUI}.
+ */
+ public SynthRadioButtonUI() {}
// ********************************
// Create PLAF
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java 2020-08-14 11:52:19.755497700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java 2020-08-14 11:52:15.220481700 +0530
@@ -42,6 +42,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthRootPaneUI}.
+ */
+ public SynthRootPaneUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java 2020-08-14 11:52:53.297972700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java 2020-08-14 11:52:48.157729600 +0530
@@ -49,6 +49,12 @@
private boolean validMinimumThumbSize;
/**
+ *
+ * Constructs a {@code SynthScrollBarUI}.
+ */
+ public SynthScrollBarUI() {}
+
+ /**
* Returns a UI.
* @return a UI
* @param c a component
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java 2020-08-14 11:53:19.629853200 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java 2020-08-14 11:53:14.131322700 +0530
@@ -54,6 +54,12 @@
private ViewportViewFocusHandler viewportViewFocusHandler;
/**
+ *
+ * Constructs a {@code SynthScrollPaneUI}.
+ */
+ public SynthScrollPaneUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java 2020-08-14 11:53:52.094809600 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java 2020-08-14 11:53:47.653121100 +0530
@@ -48,6 +48,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthSeparatorUI}.
+ */
+ public SynthSeparatorUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java 2020-08-14 11:54:24.039631800 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java 2020-08-14 11:54:19.911918300 +0530
@@ -54,6 +54,12 @@
private EditorFocusHandler editorFocusHandler = new EditorFocusHandler();
/**
+ *
+ * Constructs a {@code SynthSpinnerUI}.
+ */
+ public SynthSpinnerUI() {}
+
+ /**
* Returns a new instance of SynthSpinnerUI.
*
* @param c the JSpinner (not used)
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java 2020-08-14 11:55:06.386526700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java 2020-08-14 11:55:01.646788900 +0530
@@ -65,6 +65,11 @@
*/
private SynthStyle dividerStyle;
+ /**
+ *
+ * Constructs a {@code SynthSplitPaneUI}.
+ */
+ public SynthSplitPaneUI() {}
/**
* Creates a new SynthSplitPaneUI instance
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java 2020-08-14 11:55:39.452504700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java 2020-08-14 11:55:33.231247500 +0530
@@ -106,6 +106,12 @@
private boolean selectedTabIsPressed = false;
/**
+ *
+ * Constructs a {@code SynthTabbedPaneUI}.
+ */
+ public SynthTabbedPaneUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java 2020-08-14 11:56:18.000701100 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java 2020-08-14 11:56:13.869253100 +0530
@@ -54,6 +54,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthTableHeaderUI}.
+ */
+ public SynthTableHeaderUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param h component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableUI.java 2020-08-14 11:57:16.666784000 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTableUI.java 2020-08-14 11:57:09.282174100 +0530
@@ -88,6 +88,12 @@
//
/**
+ *
+ * Constructs a {@code SynthTableUI}.
+ */
+ public SynthTableUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java 2020-08-14 11:57:51.450560800 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java 2020-08-14 11:57:46.867002700 +0530
@@ -56,6 +56,13 @@
private Handler handler = new Handler();
private SynthStyle style;
private boolean updateKBAction = true;
+
+ /**
+ *
+ * Constructs a {@code SynthTextAreaUI}.
+ */
+ public SynthTextAreaUI() {}
+
/**
* Creates a UI object for a JTextArea.
*
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java 2020-08-14 11:58:27.136501200 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java 2020-08-14 11:58:22.559064700 +0530
@@ -57,6 +57,12 @@
private boolean updateKBAction = true;
/**
+ *
+ * Constructs a {@code SynthTextFieldUI}.
+ */
+ public SynthTextFieldUI() {}
+
+ /**
* Creates a UI for a JTextField.
*
* @param c the text field
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java 2020-08-14 12:00:07.527460900 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java 2020-08-14 11:59:58.546706500 +0530
@@ -51,6 +51,12 @@
public class SynthTextPaneUI extends SynthEditorPaneUI {
/**
+ *
+ * Constructs a {@code SynthTextPaneUI}.
+ */
+ public SynthTextPaneUI() {}
+
+ /**
* Creates a UI for the JTextPane.
*
* @param c the JTextPane object
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java 2020-08-14 12:01:02.279579400 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java 2020-08-14 12:00:55.861355400 +0530
@@ -38,6 +38,12 @@
* @since 1.7
*/
public class SynthToggleButtonUI extends SynthButtonUI {
+ /**
+ *
+ * Constructs a {@code SynthToggleButtonUI}.
+ */
+ public SynthToggleButtonUI() {}
+
// ********************************
// Create PLAF
// ********************************
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java 2020-08-14 12:01:47.227043000 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java 2020-08-14 12:01:39.720646400 +0530
@@ -58,6 +58,12 @@
private SynthStyle dragWindowStyle;
/**
+ *
+ * Constructs a {@code SynthToolBarUI}.
+ */
+ public SynthToolBarUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java 2020-08-14 12:02:32.480093900 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java 2020-08-14 12:02:27.606015700 +0530
@@ -49,6 +49,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthToolTipUI}.
+ */
+ public SynthToolTipUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTreeUI.java 2020-08-14 12:03:27.516267900 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTreeUI.java 2020-08-14 12:03:23.844040900 +0530
@@ -74,6 +74,12 @@
private Icon expandedIconWrapper = new ExpandedIconWrapper();
/**
+ *
+ * Constructs a {@code SynthTreeUI}.
+ */
+ public SynthTreeUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
--- old/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthViewportUI.java 2020-08-14 12:03:52.232991700 +0530
+++ new/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthViewportUI.java 2020-08-14 12:03:47.970577900 +0530
@@ -42,6 +42,12 @@
private SynthStyle style;
/**
+ *
+ * Constructs a {@code SynthViewportUI}.
+ */
+ public SynthViewportUI() {}
+
+ /**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for