8154213: clean up uses of boxed primitive constructors in the java.desktop module
Reviewed-by: serb, psadhukhan
--- a/jdk/make/src/classes/build/tools/generatenimbus/UIProperty.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/make/src/classes/build/tools/generatenimbus/UIProperty.java Mon Apr 25 15:09:45 2016 -0700
@@ -54,13 +54,13 @@
return String.format(" d.put(\"%s%s\", \"%s\");\n",
prefix, getName(), getValue());
case INT:
- return String.format(" d.put(\"%s%s\", new Integer(%s));\n",
+ return String.format(" d.put(\"%s%s\", Integer.valueOf(%s));\n",
prefix, getName(), getValue());
case FLOAT:
- return String.format(" d.put(\"%s%s\", new Float(%sf));\n",
+ return String.format(" d.put(\"%s%s\", Float.valueOf(%sf));\n",
prefix, getName(), getValue());
case DOUBLE:
- return String.format(" d.put(\"%s%s\", new Double(%s));\n",
+ return String.format(" d.put(\"%s%s\", Double.valueOf(%s));\n",
prefix, getName(), getValue());
case COLOR:
return String.format(" addColor(d, \"%s%s\", %s);\n",
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java Mon Apr 25 15:09:45 2016 -0700
@@ -83,7 +83,7 @@
// if we have no foreground frames, then we have to "kick" the menubar
final JFrame pingFrame = new JFrame();
- pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
+ pingFrame.getRootPane().putClientProperty("Window.alpha", Float.valueOf(0.0f));
pingFrame.setUndecorated(true);
pingFrame.setVisible(true);
pingFrame.toFront();
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaComboBoxPopup.java Mon Apr 25 15:09:45 2016 -0700
@@ -58,7 +58,7 @@
updateContents(false);
// TODO: CPlatformWindow?
- putClientProperty(CPlatformWindow.WINDOW_FADE_OUT, new Integer(150));
+ putClientProperty(CPlatformWindow.WINDOW_FADE_OUT, Integer.valueOf(150));
}
public void updateContents(final boolean remove) {
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFramePaneUI.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaInternalFramePaneUI.java Mon Apr 25 15:09:45 2016 -0700
@@ -91,7 +91,7 @@
JComponent getDock() {
if (fDock == null) {
fDock = new Dock(desktop);
- desktop.add(fDock, new Integer(399)); // Just below the DRAG_LAYER
+ desktop.add(fDock, Integer.valueOf(399)); // Just below the DRAG_LAYER
}
return fDock;
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java Mon Apr 25 15:09:45 2016 -0700
@@ -416,7 +416,7 @@
"Button.select", selected,
"Button.border",(LazyValue) t -> AquaButtonBorder.getDynamicButtonBorder(),
"Button.font", controlFont,
- "Button.textIconGap", new Integer(4),
+ "Button.textIconGap", Integer.valueOf(4),
"Button.textShiftOffset", zero, // radar 3308129 - aqua doesn't move images when pressed.
"Button.focusInputMap", controlFocusInputMap,
"Button.margin", new InsetsUIResource(0, 2, 0, 2),
@@ -635,8 +635,8 @@
//"Menu.checkIcon", emptyCheckIcon, // A non-drawing GlyphIcon to make the spacing consistent
"Menu.arrowIcon",(LazyValue) t -> AquaImageFactory.getMenuArrowIcon(),
"Menu.consumesTabs", Boolean.TRUE,
- "Menu.menuPopupOffsetY", new Integer(1),
- "Menu.submenuPopupOffsetY", new Integer(-4),
+ "Menu.menuPopupOffsetY", Integer.valueOf(1),
+ "Menu.submenuPopupOffsetY", Integer.valueOf(-4),
"MenuBar.font", menuFont,
"MenuBar.background", menuBackgroundColor, // not a menu item, not selected
@@ -694,7 +694,7 @@
"OptionPane.informationSound", null, // Info and Plain
"OptionPane.questionSound", null,
"OptionPane.warningSound", null,
- "OptionPane.buttonClickThreshhold", new Integer(500),
+ "OptionPane.buttonClickThreshhold", Integer.valueOf(500),
"OptionPane.yesButtonMnemonic", "",
"OptionPane.noButtonMnemonic", "",
"OptionPane.okButtonMnemonic", "",
@@ -717,7 +717,7 @@
"PasswordField.caretBlinkRate", textCaretBlinkRate,
"PasswordField.border", textFieldBorder,
"PasswordField.margin", zeroInsets,
- "PasswordField.echoChar", new Character((char)0x25CF),
+ "PasswordField.echoChar", Character.valueOf((char)0x25CF),
"PasswordField.capsLockIconColor", textPasswordFieldCapsLockIconColor,
"PopupMenu.font", menuFont,
@@ -736,7 +736,7 @@
"ProgressBar.selectionForeground", black,
"ProgressBar.selectionBackground", white,
"ProgressBar.border", new BorderUIResource(BorderFactory.createEmptyBorder()),
- "ProgressBar.repaintInterval", new Integer(20),
+ "ProgressBar.repaintInterval", Integer.valueOf(20),
"RadioButton.background", controlBackgroundColor,
"RadioButton.foreground", black,
@@ -772,7 +772,7 @@
"ScrollBar.border", null,
"ScrollBar.focusInputMap", aquaKeyBindings.getScrollBarInputMap(),
"ScrollBar.focusInputMap.RightToLeft", aquaKeyBindings.getScrollBarRightToLeftInputMap(),
- "ScrollBar.width", new Integer(16),
+ "ScrollBar.width", Integer.valueOf(16),
"ScrollBar.background", white,
"ScrollBar.foreground", black,
@@ -816,7 +816,7 @@
//"SplitPane.shadow", table.get("controlShadow"),
"SplitPane.background", panelBackgroundColor,
"SplitPane.border", scollListBorder,
- "SplitPane.dividerSize", new Integer(9), //$
+ "SplitPane.dividerSize", Integer.valueOf(9), //$
"SplitPaneDivider.border", null, // AquaSplitPaneDividerUI draws it
"SplitPaneDivider.horizontalGradientVariant",(LazyValue) t -> AquaSplitPaneDividerUI.getHorizontalSplitDividerGradientVariant(),
@@ -833,7 +833,7 @@
//"TabbedPane.darkShadow", table.get("controlDkShadow"),
//"TabbedPane.focus", table.get("controlText"),
"TabbedPane.opaque", useOpaqueComponents,
- "TabbedPane.textIconGap", new Integer(4),
+ "TabbedPane.textIconGap", Integer.valueOf(4),
"TabbedPane.tabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab (top, left, bottom, right)
//"TabbedPane.rightTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab (top, left, bottom, right)
"TabbedPane.leftTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab
@@ -973,9 +973,9 @@
"Tree.selectionBorderColor", selectionBackground, // match the background so it looks like we don't draw anything
"Tree.editorBorderSelectionColor", null, // The EditTextFrame provides its own border
// "Tree.editorBorder", textFieldBorder, // If you still have Sun bug 4376328 in DefaultTreeCellEditor, it has to have the same insets as TextField.border
- "Tree.leftChildIndent", new Integer(7),//$
- "Tree.rightChildIndent", new Integer(13),//$
- "Tree.rowHeight", new Integer(19),// iconHeight + 3, to match finder - a zero would have the renderer decide, except that leaves the icons touching
+ "Tree.leftChildIndent", Integer.valueOf(7),//$
+ "Tree.rightChildIndent", Integer.valueOf(13),//$
+ "Tree.rowHeight", Integer.valueOf(19),// iconHeight + 3, to match finder - a zero would have the renderer decide, except that leaves the icons touching
"Tree.scrollsOnExpand", Boolean.FALSE,
"Tree.openIcon",(LazyValue) t -> AquaImageFactory.getTreeOpenFolderIcon(), // Open folder icon
"Tree.closedIcon",(LazyValue) t -> AquaImageFactory.getTreeFolderIcon(), // Closed folder icon
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java Mon Apr 25 15:09:45 2016 -0700
@@ -521,7 +521,7 @@
}
// [2165820] Mac OS X change: mnemonics need to be triggered with ctrl-option, not just option.
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, Event.ALT_MASK | Event.CTRL_MASK), "setSelectedIndex");
- mnemonicToIndexMap.put(new Integer(mnemonic), new Integer(index));
+ mnemonicToIndexMap.put(Integer.valueOf(mnemonic), Integer.valueOf(index));
}
/**
@@ -2084,7 +2084,7 @@
if (mnemonic >= 'a' && mnemonic <= 'z') {
mnemonic -= ('a' - 'A');
}
- final Integer index = ui.mnemonicToIndexMap.get(new Integer(mnemonic));
+ final Integer index = ui.mnemonicToIndexMap.get(Integer.valueOf(mnemonic));
if (index != null && pane.isEnabledAt(index.intValue())) {
pane.setSelectedIndex(index.intValue());
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtilControlSize.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtilControlSize.java Mon Apr 25 15:09:45 2016 -0700
@@ -268,7 +268,7 @@
public SizeVariant alterFontSize(final float newSize) {
final float oldSize = fontSize == null ? 0.0f : fontSize.floatValue();
- fontSize = new Float(newSize + oldSize);
+ fontSize = newSize + oldSize;
return this;
}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenPopupFactory.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/ScreenPopupFactory.java Mon Apr 25 15:09:45 2016 -0700
@@ -32,8 +32,8 @@
import sun.swing.SwingAccessor;
class ScreenPopupFactory extends PopupFactory {
- static final Float TRANSLUCENT = new Float(248f/255f);
- static final Float OPAQUE = new Float(1.0f);
+ static final Float TRANSLUCENT = 248f/255f;
+ static final Float OPAQUE = 1.0f;
boolean fIsActive = true;
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CStrike.java Mon Apr 25 15:09:45 2016 -0700
@@ -386,7 +386,7 @@
if (generalCache == null) {
return 0L;
}
- final Long value = generalCache.get(new Integer(index));
+ final Long value = generalCache.get(Integer.valueOf(index));
if (value == null) {
return 0L;
}
@@ -415,7 +415,7 @@
generalCache = new HashMap<Integer, Long>();
}
- generalCache.put(new Integer(index), Long.valueOf(value));
+ generalCache.put(Integer.valueOf(index), Long.valueOf(value));
}
public synchronized void dispose() {
@@ -526,7 +526,7 @@
}
if (generalCache == null) return 0;
- final Float value = generalCache.get(new Integer(index));
+ final Float value = generalCache.get(Integer.valueOf(index));
if (value == null) return 0;
return value.floatValue();
}
@@ -553,7 +553,7 @@
generalCache = new HashMap<Integer, Float>();
}
- generalCache.put(new Integer(index), new Float(value));
+ generalCache.put(Integer.valueOf(index), Float.valueOf(value));
}
private static class SparseBitShiftingTwoLayerArray {
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Mon Apr 25 15:09:45 2016 -0700
@@ -378,9 +378,9 @@
// These DnD properties must be set, otherwise Swing ends up spewing NPEs
// all over the place. The values came straight off of MToolkit.
- desktopProperties.put("DnD.Autoscroll.initialDelay", new Integer(50));
- desktopProperties.put("DnD.Autoscroll.interval", new Integer(50));
- desktopProperties.put("DnD.Autoscroll.cursorHysteresis", new Integer(5));
+ desktopProperties.put("DnD.Autoscroll.initialDelay", Integer.valueOf(50));
+ desktopProperties.put("DnD.Autoscroll.interval", Integer.valueOf(50));
+ desktopProperties.put("DnD.Autoscroll.cursorHysteresis", Integer.valueOf(5));
desktopProperties.put("DnD.isDragImageSupported", Boolean.TRUE);
--- a/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/NewElementHandler.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/beans/decoder/NewElementHandler.java Mon Apr 25 15:09:45 2016 -0700
@@ -42,7 +42,7 @@
* <new class="java.lang.Long">
* <string>10</string>
* </new></pre>
- * is equivalent to {@code new Long("10")} in Java code.
+ * is equivalent to {@code Long.valueOf("10")} in Java code.
* <p>The following attributes are supported:
* <dl>
* <dt>class
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java Mon Apr 25 15:09:45 2016 -0700
@@ -128,7 +128,7 @@
addChildNode(root, "BMPVersion", bmpVersion);
addChildNode(root, "Width", width);
addChildNode(root, "Height", height);
- addChildNode(root, "BitsPerPixel", new Short(bitsPerPixel));
+ addChildNode(root, "BitsPerPixel", Short.valueOf(bitsPerPixel));
addChildNode(root, "Compression", compression);
addChildNode(root, "ImageSize", imageSize);
@@ -172,12 +172,12 @@
red = palette[j++] & 0xff;
green = palette[j++] & 0xff;
blue = palette[j++] & 0xff;
- addChildNode(entry, "Red", new Byte((byte)red));
- addChildNode(entry, "Green", new Byte((byte)green));
- addChildNode(entry, "Blue", new Byte((byte)blue));
+ addChildNode(entry, "Red", Byte.valueOf((byte)red));
+ addChildNode(entry, "Green", Byte.valueOf((byte)green));
+ addChildNode(entry, "Blue", Byte.valueOf((byte)blue));
if (numComps == 4)
addChildNode(entry, "Alpha",
- new Byte((byte)(palette[j++] & 0xff)));
+ Byte.valueOf((byte)(palette[j++] & 0xff)));
}
}
@@ -284,9 +284,9 @@
private void addXYZPoints(IIOMetadataNode root, String name, double x, double y, double z) {
IIOMetadataNode node = addChildNode(root, name, null);
- addChildNode(node, "X", new Double(x));
- addChildNode(node, "Y", new Double(y));
- addChildNode(node, "Z", new Double(z));
+ addChildNode(node, "X", Double.valueOf(x));
+ addChildNode(node, "Y", Double.valueOf(y));
+ addChildNode(node, "Z", Double.valueOf(z));
}
private IIOMetadataNode addChildNode(IIOMetadataNode root,
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java Mon Apr 25 15:09:45 2016 -0700
@@ -379,7 +379,7 @@
}
Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
- Double defaultCaretAspectRatio = new Double(0.025);
+ Double defaultCaretAspectRatio = Double.valueOf(0.025);
Color caretColor = table.getColor("caretColor");
Color controlText = table.getColor("controlText");
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java Mon Apr 25 15:09:45 2016 -0700
@@ -185,7 +185,7 @@
getIntAttr(child, "bottom", 0),
getIntAttr(child, "right", 0));
} else if ("aspect_ratio".equals(name)) {
- value = new Float(getFloatAttr(child, "value", 1.0F));
+ value = Float.valueOf(getFloatAttr(child, "value", 1.0F));
} else {
logError(themeName, "Unknown Metacity frame geometry value type: "+name);
}
--- a/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextAttribute.java Mon Apr 25 15:09:45 2016 -0700
@@ -79,7 +79,7 @@
* will be ignored.
* <li>The identity of the value does not matter, only the actual
* value. For example, {@code TextAttribute.WEIGHT_BOLD} and
- * {@code new Float(2.0)}
+ * {@code Float.valueOf(2.0f)}
* indicate the same {@code WEIGHT}.
* <li>Attribute values of type {@code Number} (used for
* {@code WEIGHT}, {@code WIDTH}, {@code POSTURE},
--- a/jdk/src/java.desktop/share/classes/java/awt/font/TextMeasurer.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/font/TextMeasurer.java Mon Apr 25 15:09:45 2016 -0700
@@ -105,7 +105,7 @@
String s = System.getProperty("estLines");
if (s != null) {
try {
- Float f = new Float(s);
+ Float f = Float.valueOf(s);
EST_LINES = f.floatValue();
}
catch(NumberFormatException e) {
--- a/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/renderable/ParameterBlock.java Mon Apr 25 15:09:45 2016 -0700
@@ -392,7 +392,7 @@
* the specified parameter.
*/
public ParameterBlock add(float f) {
- return add(new Float(f));
+ return add(Float.valueOf(f));
}
/**
@@ -403,7 +403,7 @@
* the specified parameter.
*/
public ParameterBlock add(double d) {
- return add(new Double(d));
+ return add(Double.valueOf(d));
}
/**
@@ -521,7 +521,7 @@
* the specified parameter.
*/
public ParameterBlock set(float f, int index) {
- return set(new Float(f), index);
+ return set(Float.valueOf(f), index);
}
/**
@@ -537,7 +537,7 @@
* the specified parameter.
*/
public ParameterBlock set(double d, int index) {
- return set(new Double(d), index);
+ return set(Double.valueOf(d), index);
}
/**
--- a/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JLayeredPane.java Mon Apr 25 15:09:45 2016 -0700
@@ -98,7 +98,7 @@
* <PRE>
* layeredPane.add(child, JLayeredPane.DEFAULT_LAYER);
* or
- * layeredPane.add(child, new Integer(10));
+ * layeredPane.add(child, Integer.valueOf.valueOf(10));
* </PRE>
* The layer attribute can also be set on a Component by calling<PRE>
* layeredPaneParent.setLayer(child, 10)</PRE>
@@ -162,23 +162,23 @@
@SuppressWarnings("serial")
public class JLayeredPane extends JComponent implements Accessible {
/// Watch the values in getObjectForLayer()
- /** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
+ /** Convenience object defining the Default layer. Equivalent to Integer.valueOf(0).*/
public static final Integer DEFAULT_LAYER = 0;
- /** Convenience object defining the Palette layer. Equivalent to new Integer(100).*/
+ /** Convenience object defining the Palette layer. Equivalent to Integer.valueOf(100).*/
public static final Integer PALETTE_LAYER = 100;
- /** Convenience object defining the Modal layer. Equivalent to new Integer(200).*/
+ /** Convenience object defining the Modal layer. Equivalent to Integer.valueOf(200).*/
public static final Integer MODAL_LAYER = 200;
- /** Convenience object defining the Popup layer. Equivalent to new Integer(300).*/
+ /** Convenience object defining the Popup layer. Equivalent to Integer.valueOf(300).*/
public static final Integer POPUP_LAYER = 300;
- /** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
+ /** Convenience object defining the Drag layer. Equivalent to Integer.valueOf(400).*/
public static final Integer DRAG_LAYER = 400;
/** Convenience object defining the Frame Content layer.
* This layer is normally only use to position the contentPane and menuBar
* components of JFrame.
- * Equivalent to new Integer(-30000).
+ * Equivalent to Integer.valueOf(-30000).
* @see JFrame
*/
- public static final Integer FRAME_CONTENT_LAYER = new Integer(-30000);
+ public static final Integer FRAME_CONTENT_LAYER = -30000;
/** Bound property */
public static final String LAYER_PROPERTY = "layeredContainerLayer";
--- a/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JProgressBar.java Mon Apr 25 15:09:45 2016 -0700
@@ -478,7 +478,7 @@
if (format == null) {
format = NumberFormat.getPercentInstance();
}
- return format.format(new Double(getPercentComplete()));
+ return format.format(Double.valueOf(getPercentComplete()));
}
}
--- a/jdk/src/java.desktop/share/classes/javax/swing/JTable.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JTable.java Mon Apr 25 15:09:45 2016 -0700
@@ -81,7 +81,7 @@
* TableModel dataModel = new AbstractTableModel() {
* public int getColumnCount() { return 10; }
* public int getRowCount() { return 10;}
- * public Object getValueAt(int row, int col) { return new Integer(row*col); }
+ * public Object getValueAt(int row, int col) { return Integer.valueOf(row*col); }
* };
* JTable table = new JTable(dataModel);
* JScrollPane scrollpane = new JScrollPane(table);
--- a/jdk/src/java.desktop/share/classes/javax/swing/SpinnerNumberModel.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/SpinnerNumberModel.java Mon Apr 25 15:09:45 2016 -0700
@@ -51,10 +51,10 @@
* range zero to one hundred, with
* fifty as the initial value, one could write:
* <pre>
- * Integer value = new Integer(50);
- * Integer min = new Integer(0);
- * Integer max = new Integer(100);
- * Integer step = new Integer(1);
+ * Integer value = Integer.valueOf(50);
+ * Integer min = Integer.valueOf(0);
+ * Integer max = Integer.valueOf(100);
+ * Integer step = Integer.valueOf(1);
* SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
* int fifty = model.getNumber().intValue();
* </pre>
@@ -175,7 +175,8 @@
* <code>minimum <= value <= maximum</code>
*/
public SpinnerNumberModel(double value, double minimum, double maximum, double stepSize) {
- this(new Double(value), new Double(minimum), new Double(maximum), new Double(stepSize));
+ this(Double.valueOf(value), Double.valueOf(minimum),
+ Double.valueOf(maximum), Double.valueOf(stepSize));
}
@@ -337,10 +338,10 @@
if ((value instanceof Float) || (value instanceof Double)) {
double v = value.doubleValue() + (stepSize.doubleValue() * (double)dir);
if (value instanceof Double) {
- newValue = new Double(v);
+ newValue = Double.valueOf(v);
}
else {
- newValue = new Float(v);
+ newValue = Float.valueOf((float)v);
}
} else {
long v = value.longValue() + (stepSize.longValue() * (long)dir);
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java Mon Apr 25 15:09:45 2016 -0700
@@ -120,7 +120,7 @@
Object[] uiDefaults = {
"Font", new Font("Dialog", Font.BOLD, 12),
"Color", Color.red,
- "five", new Integer(5)
+ "five", Integer.valueOf(5)
}
UIDefaults myDefaults = new UIDefaults(uiDefaults);
* </pre>
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/OceanTheme.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/OceanTheme.java Mon Apr 25 15:09:45 2016 -0700
@@ -134,7 +134,7 @@
new BorderUIResource.LineBorderUIResource(getPrimary1());
// .30 0 DDE8F3 white secondary2
java.util.List<?> buttonGradient = Arrays.asList(
- new Object[] {new Float(.3f), new Float(0f),
+ new Object[] {Float.valueOf(.3f), Float.valueOf(0f),
new ColorUIResource(0xDDE8F3), getWhite(), getSecondary2() });
// Other possible properties that aren't defined:
@@ -150,7 +150,7 @@
Object directoryIcon = getIconResource("icons/ocean/directory.gif");
Object fileIcon = getIconResource("icons/ocean/file.gif");
java.util.List<?> sliderGradient = Arrays.asList(new Object[] {
- new Float(.3f), new Float(.2f),
+ Float.valueOf(.3f), Float.valueOf(.2f),
c8ddf2, getWhite(), new ColorUIResource(SECONDARY2) });
Object[] defaults = new Object[] {
@@ -192,7 +192,7 @@
"Menu.opaque", Boolean.FALSE,
"MenuBar.gradient", Arrays.asList(new Object[] {
- new Float(1f), new Float(0f),
+ Float.valueOf(1f), Float.valueOf(0f),
getWhite(), dadada,
new ColorUIResource(dadada) }),
"MenuBar.borderColor", cccccc,
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/JTextComponent.java Mon Apr 25 15:09:45 2016 -0700
@@ -2580,7 +2580,7 @@
* @param e the DocumentEvent
*/
public void insertUpdate(DocumentEvent e) {
- final Integer pos = new Integer (e.getOffset());
+ final Integer pos = e.getOffset();
if (SwingUtilities.isEventDispatchThread()) {
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
} else {
@@ -2602,7 +2602,7 @@
* @param e the DocumentEvent
*/
public void removeUpdate(DocumentEvent e) {
- final Integer pos = new Integer (e.getOffset());
+ final Integer pos = e.getOffset();
if (SwingUtilities.isEventDispatchThread()) {
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
} else {
@@ -2624,7 +2624,7 @@
* @param e the DocumentEvent
*/
public void changedUpdate(DocumentEvent e) {
- final Integer pos = new Integer (e.getOffset());
+ final Integer pos = e.getOffset();
if (SwingUtilities.isEventDispatchThread()) {
firePropertyChange(ACCESSIBLE_TEXT_PROPERTY, null, pos);
} else {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/NumberFormatter.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/NumberFormatter.java Mon Apr 25 15:09:45 2016 -0700
@@ -73,7 +73,7 @@
* type the value class represents. For example:
* <code>setValueClass(Integer.class)</code> will cause the resulting
* value to be created via
- * <code>new Integer(((Number)formatter.parseObject(string)).intValue())</code>.
+ * <code>Integer.valueOf(((Number)formatter.parseObject(string)).intValue())</code>.
* This is typically useful if you
* wish to set a min/max value as the various <code>Number</code>
* implementations are generally not comparable to each other. This is also
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StyleConstants.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StyleConstants.java Mon Apr 25 15:09:45 2016 -0700
@@ -608,7 +608,7 @@
* @param i the value
*/
public static void setFirstLineIndent(MutableAttributeSet a, float i) {
- a.addAttribute(FirstLineIndent, new Float(i));
+ a.addAttribute(FirstLineIndent, Float.valueOf(i));
}
/**
@@ -632,7 +632,7 @@
* @param i the value
*/
public static void setRightIndent(MutableAttributeSet a, float i) {
- a.addAttribute(RightIndent, new Float(i));
+ a.addAttribute(RightIndent, Float.valueOf(i));
}
/**
@@ -656,7 +656,7 @@
* @param i the value
*/
public static void setLeftIndent(MutableAttributeSet a, float i) {
- a.addAttribute(LeftIndent, new Float(i));
+ a.addAttribute(LeftIndent, Float.valueOf(i));
}
/**
@@ -680,7 +680,7 @@
* @param i the value
*/
public static void setLineSpacing(MutableAttributeSet a, float i) {
- a.addAttribute(LineSpacing, new Float(i));
+ a.addAttribute(LineSpacing, Float.valueOf(i));
}
/**
@@ -704,7 +704,7 @@
* @param i the value
*/
public static void setSpaceAbove(MutableAttributeSet a, float i) {
- a.addAttribute(SpaceAbove, new Float(i));
+ a.addAttribute(SpaceAbove, Float.valueOf(i));
}
/**
@@ -728,7 +728,7 @@
* @param i the value
*/
public static void setSpaceBelow(MutableAttributeSet a, float i) {
- a.addAttribute(SpaceBelow, new Float(i));
+ a.addAttribute(SpaceBelow, Float.valueOf(i));
}
/**
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/CSS.java Mon Apr 25 15:09:45 2016 -0700
@@ -2564,7 +2564,7 @@
* represents the CSS attribute value
*/
Object toStyleConstants(StyleConstants key, View v) {
- return new Float(getValue(false));
+ return Float.valueOf(getValue(false));
}
/** If true, span is a percentage value, and that to determine
@@ -2837,25 +2837,25 @@
static Hashtable<String, Float> lengthMapping = new Hashtable<String, Float>(6);
static Hashtable<String, Float> w3cLengthMapping = new Hashtable<String, Float>(6);
static {
- lengthMapping.put("pt", new Float(1f));
+ lengthMapping.put("pt", Float.valueOf(1f));
// Not sure about 1.3, determined by experiementation.
- lengthMapping.put("px", new Float(1.3f));
- lengthMapping.put("mm", new Float(2.83464f));
- lengthMapping.put("cm", new Float(28.3464f));
- lengthMapping.put("pc", new Float(12f));
- lengthMapping.put("in", new Float(72f));
+ lengthMapping.put("px", Float.valueOf(1.3f));
+ lengthMapping.put("mm", Float.valueOf(2.83464f));
+ lengthMapping.put("cm", Float.valueOf(28.3464f));
+ lengthMapping.put("pc", Float.valueOf(12f));
+ lengthMapping.put("in", Float.valueOf(72f));
int res = 72;
try {
res = Toolkit.getDefaultToolkit().getScreenResolution();
} catch (HeadlessException e) {
}
// mapping according to the CSS2 spec
- w3cLengthMapping.put("pt", new Float(res/72f));
- w3cLengthMapping.put("px", new Float(1f));
- w3cLengthMapping.put("mm", new Float(res/25.4f));
- w3cLengthMapping.put("cm", new Float(res/2.54f));
- w3cLengthMapping.put("pc", new Float(res/6f));
- w3cLengthMapping.put("in", new Float(res));
+ w3cLengthMapping.put("pt", Float.valueOf(res/72f));
+ w3cLengthMapping.put("px", Float.valueOf(1f));
+ w3cLengthMapping.put("mm", Float.valueOf(res/25.4f));
+ w3cLengthMapping.put("cm", Float.valueOf(res/2.54f));
+ w3cLengthMapping.put("pc", Float.valueOf(res/6f));
+ w3cLengthMapping.put("in", Float.valueOf((float)res));
}
LengthUnit(String value, short defaultType, float defaultValue) {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFAttributes.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/rtf/RTFAttributes.java Mon Apr 25 15:09:45 2016 -0700
@@ -357,7 +357,7 @@
public static NumericAttribute NewTwips(int d, Object s, String r,
float ds, int dr)
{
- return new NumericAttribute(d, s, r, new Float(ds), dr, 20f);
+ return new NumericAttribute(d, s, r, Float.valueOf(ds), dr, 20f);
}
public static NumericAttribute NewTwips(int d, Object s, String r,
@@ -378,7 +378,7 @@
if (scale == 1f)
swingValue = Integer.valueOf(parameter);
else
- swingValue = new Float(parameter / scale);
+ swingValue = Float.valueOf(parameter / scale);
target.addAttribute(swingName, swingValue);
return true;
}
--- a/jdk/src/java.desktop/share/classes/sun/awt/image/PNGImageDecoder.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/awt/image/PNGImageDecoder.java Mon Apr 25 15:09:45 2016 -0700
@@ -87,7 +87,7 @@
properties.put(key,value);
}
private void property(String key,float value) {
- property(key,new Float(value));
+ property(key, Float.valueOf(value));
}
private final void pngassert(boolean b) throws IOException {
if(!b) {
--- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java Mon Apr 25 15:09:45 2016 -0700
@@ -1402,8 +1402,8 @@
format.setParseIntegerOnly(false);
format.setDecimalSeparatorAlwaysShown(true);
NumberFormatter nf = new NumberFormatter(format);
- nf.setMinimum(new Float(0.0f));
- nf.setMaximum(new Float(999.0f));
+ nf.setMinimum(Float.valueOf(0.0f));
+ nf.setMaximum(Float.valueOf(999.0f));
nf.setAllowsInvalid(true);
nf.setCommitsOnValidEdit(true);
@@ -1836,10 +1836,10 @@
rmVal = mediaSize.getX(units) - pax - paw;
bmVal = mediaSize.getY(units) - pay - pah;
- lmObj = new Float(lmVal);
- rmObj = new Float(rmVal);
- tmObj = new Float(tmVal);
- bmObj = new Float(bmVal);
+ lmObj = lmVal;
+ rmObj = rmVal;
+ tmObj = tmVal;
+ bmObj = bmVal;
/* Now we know the values to use, we need to assign them
* to the fields appropriate for the orientation.
--- a/jdk/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Mon Apr 25 09:25:26 2016 -0700
+++ b/jdk/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java Mon Apr 25 15:09:45 2016 -0700
@@ -117,7 +117,7 @@
if (refreshTimeStr != null) {
try {
- minRefreshTime = (new Integer(refreshTimeStr)).intValue();
+ minRefreshTime = (Integer.valueOf(refreshTimeStr)).intValue();
} catch (NumberFormatException e) {
}
if (minRefreshTime < DEFAULT_MINREFRESH) {