Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit e0763c5

Browse files
committedAug 26, 2020
8250850: Address reliance on default constructors in the javax.swing.plaf.metal APIs
Reviewed-by: serb
1 parent 1a24996 commit e0763c5

24 files changed

+221
-1
lines changed
 

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java

+75
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,21 @@ public class MetalBorders {
5757
static Object NO_BUTTON_ROLLOVER =
5858
new StringUIClientPropertyKey("NoButtonRollover");
5959

60+
/**
61+
* Constructs a {@code MetalBorders}.
62+
*/
63+
public MetalBorders() {}
64+
6065
/**
6166
* The class represents the 3D border.
6267
*/
6368
@SuppressWarnings("serial") // Superclass is not serializable across versions
6469
public static class Flush3DBorder extends AbstractBorder implements UIResource{
70+
/**
71+
* Constructs a {@code Flush3DBorder}.
72+
*/
73+
public Flush3DBorder() {}
74+
6575
public void paintBorder(Component c, Graphics g, int x, int y,
6676
int w, int h) {
6777
if (c.isEnabled()) {
@@ -88,6 +98,11 @@ public static class ButtonBorder extends AbstractBorder implements UIResource {
8898
*/
8999
protected static Insets borderInsets = new Insets( 3, 3, 3, 3 );
90100

101+
/**
102+
* Constructs a {@code ButtonBorder}.
103+
*/
104+
public ButtonBorder() {}
105+
91106
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
92107
if (!(c instanceof AbstractButton)) {
93108
return;
@@ -205,6 +220,11 @@ public Insets getBorderInsets(Component c, Insets newInsets) {
205220
public static class InternalFrameBorder extends AbstractBorder implements UIResource {
206221
private static final int corner = 14;
207222

223+
/**
224+
* Constructs a {@code InternalFrameBorder}.
225+
*/
226+
public InternalFrameBorder() {}
227+
208228
public void paintBorder(Component c, Graphics g, int x, int y,
209229
int w, int h) {
210230

@@ -464,6 +484,11 @@ protected Color getActiveBackground() {
464484
public static class PaletteBorder extends AbstractBorder implements UIResource {
465485
int titleHeight = 0;
466486

487+
/**
488+
* Constructs a {@code PaletteBorder}.
489+
*/
490+
public PaletteBorder() {}
491+
467492
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
468493

469494
g.translate(x,y);
@@ -490,6 +515,11 @@ public Insets getBorderInsets(Component c, Insets newInsets) {
490515
public static class OptionDialogBorder extends AbstractBorder implements UIResource {
491516
int titleHeight = 0;
492517

518+
/**
519+
* Constructs a {@code OptionDialogBorder}.
520+
*/
521+
public OptionDialogBorder() {}
522+
493523
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
494524

495525
g.translate(x,y);
@@ -559,6 +589,11 @@ public static class MenuBarBorder extends AbstractBorder implements UIResource {
559589
*/
560590
protected static Insets borderInsets = new Insets( 1, 0, 1, 0 );
561591

592+
/**
593+
* Constructs a {@code MenuBarBorder}.
594+
*/
595+
public MenuBarBorder() {}
596+
562597
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
563598
g.translate(x, y);
564599

@@ -600,6 +635,11 @@ public static class MenuItemBorder extends AbstractBorder implements UIResource
600635
*/
601636
protected static Insets borderInsets = new Insets( 2, 2, 2, 2 );
602637

638+
/**
639+
* Constructs a {@code MenuItemBorder}.
640+
*/
641+
public MenuItemBorder() {}
642+
603643
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
604644
if (!(c instanceof JMenuItem)) {
605645
return;
@@ -655,6 +695,11 @@ public static class PopupMenuBorder extends AbstractBorder implements UIResource
655695
*/
656696
protected static Insets borderInsets = new Insets( 3, 1, 2, 1 );
657697

698+
/**
699+
* Constructs a {@code PopupMenuBorder}.
700+
*/
701+
public PopupMenuBorder() {}
702+
658703
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
659704
g.translate( x, y );
660705

@@ -682,6 +727,11 @@ public Insets getBorderInsets(Component c, Insets newInsets) {
682727
@SuppressWarnings("serial") // Superclass is not serializable across versions
683728
public static class RolloverButtonBorder extends ButtonBorder {
684729

730+
/**
731+
* Constructs a {@code RolloverButtonBorder}.
732+
*/
733+
public RolloverButtonBorder() {}
734+
685735
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
686736
AbstractButton b = (AbstractButton) c;
687737
ButtonModel model = b.getModel();
@@ -744,6 +794,11 @@ public static class ToolBarBorder extends AbstractBorder implements UIResource,
744794
MetalLookAndFeel.getControlDarkShadow(),
745795
UIManager.getColor("ToolBar.background"));
746796

797+
/**
798+
* Constructs a {@code ToolBarBorder}.
799+
*/
800+
public ToolBarBorder() {}
801+
747802
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h )
748803
{
749804
if (!(c instanceof JToolBar)) {
@@ -876,6 +931,11 @@ public static Border getTextFieldBorder() {
876931
@SuppressWarnings("serial") // Superclass is not serializable across versions
877932
public static class TextFieldBorder extends Flush3DBorder {
878933

934+
/**
935+
* Constructs a {@code TextFieldBorder}.
936+
*/
937+
public TextFieldBorder() {}
938+
879939
public void paintBorder(Component c, Graphics g, int x, int y,
880940
int w, int h) {
881941

@@ -903,6 +963,11 @@ public void paintBorder(Component c, Graphics g, int x, int y,
903963
*/
904964
@SuppressWarnings("serial") // Superclass is not serializable across versions
905965
public static class ScrollPaneBorder extends AbstractBorder implements UIResource {
966+
/**
967+
* Constructs a {@code ScrollPaneBorder}.
968+
*/
969+
public ScrollPaneBorder() {}
970+
906971
public void paintBorder(Component c, Graphics g, int x, int y,
907972
int w, int h) {
908973

@@ -966,6 +1031,11 @@ public static Border getToggleButtonBorder() {
9661031
*/
9671032
@SuppressWarnings("serial") // Superclass is not serializable across versions
9681033
public static class ToggleButtonBorder extends ButtonBorder {
1034+
/**
1035+
* Constructs a {@code ToggleButtonBorder}.
1036+
*/
1037+
public ToggleButtonBorder() {}
1038+
9691039
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
9701040
AbstractButton button = (AbstractButton)c;
9711041
ButtonModel model = button.getModel();
@@ -1000,6 +1070,11 @@ public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
10001070
@SuppressWarnings("serial") // Superclass is not serializable across versions
10011071
public static class TableHeaderBorder extends javax.swing.border.AbstractBorder {
10021072

1073+
/**
1074+
* Constructs a {@code TableHeaderBorder}.
1075+
*/
1076+
public TableHeaderBorder() {}
1077+
10031078
/**
10041079
* The border insets.
10051080
*/

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalButtonUI.java

+5
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ public class MetalButtonUI extends BasicButtonUI {
7676
// Create PLAF
7777
// ********************************
7878

79+
/**
80+
* Constructs a {@code MetalButtonUI}.
81+
*/
82+
public MetalButtonUI() {}
83+
7984
/**
8085
* Returns an instance of {@code MetalButtonUI}.
8186
*

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
@SuppressWarnings("serial") // Same-version serialization only
5050
public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
5151

52+
/**
53+
* Constructs a {@code MetalCheckBoxIcon}.
54+
*/
55+
public MetalCheckBoxIcon() {}
56+
5257
/**
5358
* Returns the size of the control.
5459
*

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java

+5
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public class MetalCheckBoxUI extends MetalRadioButtonUI {
6868
// Create PlAF
6969
// ********************************
7070

71+
/**
72+
* Constructs a {@code MetalCheckBoxUI}.
73+
*/
74+
public MetalCheckBoxUI() {}
75+
7176
/**
7277
* Returns an instance of {@code MetalCheckBoxUI}.
7378
*

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java

+4
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,9 @@ public Insets getBorderInsets(Component c, Insets insets) {
140140
@SuppressWarnings("serial") // Same-version serialization only
141141
public static class UIResource extends MetalComboBoxEditor
142142
implements javax.swing.plaf.UIResource {
143+
/**
144+
* Constructs a {@code UIResource}.
145+
*/
146+
public UIResource() {}
143147
}
144148
}

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxIcon.java

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
@SuppressWarnings("serial") // Same-version serialization only
4444
public class MetalComboBoxIcon implements Icon, Serializable {
4545

46+
/**
47+
* Constructs a {@code MetalComboBoxIcon}.
48+
*/
49+
public MetalComboBoxIcon() {}
50+
4651
/**
4752
* Paints the horizontal bars for the
4853
*/

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java

+15
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@
5454
@SuppressWarnings("serial") // Same-version serialization only
5555
public class MetalComboBoxUI extends BasicComboBoxUI {
5656

57+
/**
58+
* Constructs a {@code MetalComboBoxUI}.
59+
*/
60+
public MetalComboBoxUI() {}
61+
5762
/**
5863
* Constructs an instance of {@code MetalComboBoxUI}.
5964
*
@@ -210,6 +215,11 @@ public PropertyChangeListener createPropertyChangeListener() {
210215
* Instantiate it only within subclasses of {@code MetalComboBoxUI}.
211216
*/
212217
public class MetalPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler {
218+
/**
219+
* Constructs a {@code MetalPropertyChangeListener}.
220+
*/
221+
public MetalPropertyChangeListener() {}
222+
213223
public void propertyChange(PropertyChangeEvent e) {
214224
super.propertyChange( e );
215225
String propertyName = e.getPropertyName();
@@ -255,6 +265,11 @@ protected LayoutManager createLayoutManager() {
255265
* Instantiate it only within subclasses of {@code MetalComboBoxUI}.
256266
*/
257267
public class MetalComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
268+
/**
269+
* Constructs a {@code MetalComboBoxLayoutManager}.
270+
*/
271+
public MetalComboBoxLayoutManager() {}
272+
258273
public void layoutContainer( Container parent ) {
259274
layoutComboBox( parent, this );
260275
}

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java

+5
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,11 @@ protected FilterComboBoxRenderer createFilterComboBoxRenderer() {
11291129
*/
11301130
@SuppressWarnings("serial") // Superclass is not serializable across versions
11311131
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
1132+
/**
1133+
* Constructs a {@code FilterComboBoxRenderer}.
1134+
*/
1135+
public FilterComboBoxRenderer() {}
1136+
11321137
public Component getListCellRendererComponent(JList<?> list,
11331138
Object value, int index, boolean isSelected,
11341139
boolean cellHasFocus) {

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalIconFactory.java

+29
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ public class MetalIconFactory implements Serializable {
102102
*/
103103
public static final boolean LIGHT = true;
104104

105+
/**
106+
* Constructs a {@code MetalIconFactory}.
107+
*/
108+
public MetalIconFactory() {}
109+
105110
// Accessor functions for Icons. Does the caching work.
106111
/**
107112
* Returns the instance of {@code FileChooserDetailViewIcon}.
@@ -645,6 +650,11 @@ public int getIconHeight() {
645650
public static class PaletteCloseIcon implements Icon, UIResource, Serializable{
646651
int iconSize = 7;
647652

653+
/**
654+
* Constructs a {@code PaletteCloseIcon}.
655+
*/
656+
public PaletteCloseIcon() {}
657+
648658
public void paintIcon(Component c, Graphics g, int x, int y) {
649659
JButton parentButton = (JButton)c;
650660
ButtonModel buttonModel = parentButton.getModel();
@@ -1648,6 +1658,11 @@ public static class FolderIcon16 implements Icon, Serializable {
16481658

16491659
ImageCacher imageCacher;
16501660

1661+
/**
1662+
* Constructs a {@code FolderIcon16}.
1663+
*/
1664+
public FolderIcon16() {}
1665+
16511666
public void paintIcon(Component c, Graphics g, int x, int y) {
16521667
GraphicsConfiguration gc = c.getGraphicsConfiguration();
16531668
if (imageCacher == null) {
@@ -1739,6 +1754,11 @@ private void paintMe(Component c, Graphics g) {
17391754
*/
17401755
@SuppressWarnings("serial") // Same-version serialization only
17411756
public static class TreeFolderIcon extends FolderIcon16 {
1757+
/**
1758+
* Constructs a {@code TreeFolderIcon}.
1759+
*/
1760+
public TreeFolderIcon() {}
1761+
17421762
public int getShift() { return -1; }
17431763
public int getAdditionalHeight() { return 2; }
17441764
}
@@ -1762,6 +1782,11 @@ public static class FileIcon16 implements Icon, Serializable {
17621782

17631783
ImageCacher imageCacher;
17641784

1785+
/**
1786+
* Constructs a {@code FileIcon16}.
1787+
*/
1788+
public FileIcon16() {}
1789+
17651790
public void paintIcon(Component c, Graphics g, int x, int y) {
17661791
GraphicsConfiguration gc = c.getGraphicsConfiguration();
17671792
if (imageCacher == null) {
@@ -1839,6 +1864,10 @@ private void paintMe(Component c, Graphics g) {
18391864
* The class represents a tree leaf icon.
18401865
*/
18411866
public static class TreeLeafIcon extends FileIcon16 {
1867+
/**
1868+
* Constructs a {@code TreeLeafIcon}.
1869+
*/
1870+
public TreeLeafIcon() {}
18421871
public int getShift() { return 2; }
18431872
public int getAdditionalHeight() { return 4; }
18441873
}

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLabelUI.java

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ public class MetalLabelUI extends BasicLabelUI
5656

5757
private static final Object METAL_LABEL_UI_KEY = new Object();
5858

59+
/**
60+
* Constructs a {@code MetalLabelUI}.
61+
*/
62+
public MetalLabelUI() {}
63+
5964
/**
6065
* Returns an instance of {@code MetalLabelUI}.
6166
*

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ public class MetalLookAndFeel extends BasicLookAndFeel
108108
*/
109109
private static boolean useSystemFonts;
110110

111+
/**
112+
* Constructs a {@code MetalLookAndFeel}.
113+
*/
114+
public MetalLookAndFeel() {}
111115

112116
/**
113117
* Returns true if running on Windows.

‎src/java.desktop/share/classes/javax/swing/plaf/metal/MetalMenuBarUI.java

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
* @since 1.5
4040
*/
4141
public class MetalMenuBarUI extends BasicMenuBarUI {
42+
/**
43+
* Constructs a {@code MetalMenuBarUI}.
44+
*/
45+
public MetalMenuBarUI() {}
46+
4247
/**
4348
* Creates the <code>ComponentUI</code> implementation for the passed
4449
* in component.

0 commit comments

Comments
 (0)
This repository has been archived.