Skip to content
Permalink
Browse files
8257512: Remove use of deprecated primitive constructors in JavaFX
Reviewed-by: kcr, nlisker
  • Loading branch information
arapte committed Mar 12, 2021
1 parent 1473ea9 commit 92d623227e923802c602819638f88b7b8aca9a44
Showing 27 changed files with 75 additions and 75 deletions.
@@ -107,7 +107,7 @@ public SkinningMesh(PolygonMesh mesh, float[][] weights, Affine[] bindTransforms
weightIndices[j] = new ArrayList<Integer>();
for (int i = 0; i < nPoints; i++) {
if (weights[j][i] != 0.0f) {
weightIndices[j].add(new Integer(i));
weightIndices[j].add(i);
}
}
}
@@ -89,7 +89,7 @@ public Number fromString(String string) {
return null;
}
try {
return (Double) new Double(string);
return Double.valueOf(string);
} catch (Exception ignored) {
return 0;
}
@@ -132,9 +132,9 @@ public X fromString(String string) {
if (clzX.isAssignableFrom(String.class)) {
return (X) string;
} else if (clzX.isAssignableFrom(Double.class)) {
return (X) new Double(string);
return (X) Double.valueOf(string);
} else if (clzX.isAssignableFrom(Integer.class)) {
return (X) new Integer(string);
return (X) Integer.valueOf(string);
}
} catch (NumberFormatException ex) {
Logger.getLogger(XYDataVisualizer.class.getName()).log(Level.FINE,
@@ -172,7 +172,7 @@ public Y fromString(String string) {
if (string == null) {
return null;
}
Y y = (Y) new Double(string);
Y y = (Y) Double.valueOf(string);
return y;
}
}));
@@ -49,9 +49,9 @@ public class SampleTableModel extends AbstractTableModel {
private static ObservableList<BarChart.Series> bcData;
private final String[] names = {"2007", "2008", "2009"};
private Object[][] data = {
{new Double(567), new Double(956), new Double(1154)},
{new Double(1292), new Double(1665), new Double(1927)},
{new Double(1292), new Double(2559), new Double(2774)}
{Double.valueOf(567), Double.valueOf(956), Double.valueOf(1154)},
{Double.valueOf(1292), Double.valueOf(1665), Double.valueOf(1927)},
{Double.valueOf(1292), Double.valueOf(2559), Double.valueOf(2774)}
};

public double getTickUnit() {
@@ -218,8 +218,8 @@ public void run() {
}

private Pane createBrowser() {
Double widthDouble = new Integer(PANEL_WIDTH).doubleValue();
Double heightDouble = new Integer(PANEL_HEIGHT).doubleValue();
Double widthDouble = Double.valueOf(PANEL_WIDTH);
Double heightDouble = Double.valueOf(PANEL_HEIGHT);
WebView view = new WebView();
view.setMinSize(widthDouble, heightDouble);
view.setPrefSize(widthDouble, heightDouble);
@@ -176,8 +176,8 @@ private double[][] getTempArray(int size) {
// @Override protected void layoutChildren() {
// List<Node> sortedChidlren = new ArrayList<>(getChildren());
// Collections.sort(sortedChidlren, (c1, c2)
// -> new Double(c2.prefHeight(-1)).compareTo(
// new Double(c1.prefHeight(-1))));
// -> Double.valueOf(c2.prefHeight(-1)).compareTo(
// Double.valueOf(c1.prefHeight(-1))));
// double currentX = pad;
// for (Node c : sortedChidlren) {
// double width = c.prefWidth(-1);
@@ -88,8 +88,8 @@ public CustomPane(Node... children) {
@Override protected void layoutChildren() {
List<Node> sortedManagedChidlren = new ArrayList<>(getManagedChildren());
Collections.sort(sortedManagedChidlren, (c1, c2)
-> new Double(c2.prefHeight(-1)).compareTo(
new Double(c1.prefHeight(-1))));
-> Double.valueOf(c2.prefHeight(-1)).compareTo(
Double.valueOf(c1.prefHeight(-1))));
double currentX = pad;
for (Node c : sortedManagedChidlren) {
double width = c.prefWidth(-1);
@@ -92,8 +92,8 @@ public CustomTilePane(Node... children) {
// @Override protected void layoutChildren() {
// List<Node> sortedChidlren = new ArrayList<>(getChildren());
// Collections.sort(sortedChidlren, (c1, c2)
// -> new Double(c2.prefHeight(-1)).compareTo(
// new Double(c1.prefHeight(-1))));
// -> Double.valueOf(c2.prefHeight(-1)).compareTo(
// Double.valueOf(c1.prefHeight(-1))));
// double currentX = pad;
// for (Node c : sortedChidlren) {
// double width = c.prefWidth(-1);
@@ -172,8 +172,8 @@ static double computeYOffset(double height, double contentHeight, VPos vpos) {

List<Node> sortedManagedChidlren = new ArrayList<>(getManagedChildren());
Collections.sort(sortedManagedChidlren, (c1, c2)
-> new Double(c2.prefHeight(-1)).compareTo(
new Double(c1.prefHeight(-1))));
-> Double.valueOf(c2.prefHeight(-1)).compareTo(
Double.valueOf(c1.prefHeight(-1))));
List<Node> managed = sortedManagedChidlren;
HPos hpos = getAlignmentInternal().getHpos();
VPos vpos = getAlignmentInternal().getVpos();
@@ -49,7 +49,7 @@ public void setUp() {

@Test
public void testAddRemove() {
Change<Integer> change = new NonIterableChange.SimpleRemovedChange<Integer>(0, 1, new Integer(5), originalList);
Change<Integer> change = new NonIterableChange.SimpleRemovedChange<Integer>(0, 1, Integer.valueOf(5), originalList);
MappingChange<Integer, String> mapChange = new MappingChange<Integer, String>(change,
e -> e.toString(), list);

@@ -286,47 +286,47 @@ public class DurationTest {

@Test public void add_ZERO_and_INDEFINITE_ResultsInIndefinite() {
//assertTrue(0.0 + Double.POSITIVE_INFINITY == Double.POSITIVE_INFINITY); // sanity check
assertEquals(new Double(Double.POSITIVE_INFINITY), new Double(0.0 + Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.POSITIVE_INFINITY), Double.valueOf(0.0 + Double.POSITIVE_INFINITY)); // sanity check

assertTrue(Duration.ZERO.add(Duration.INDEFINITE).isIndefinite());
assertFalse(Duration.ZERO.add(Duration.INDEFINITE).isUnknown());
}

@Test public void add_ONE_and_INDEFINITE_ResultsInIndefinite() {
//assertTrue(1.0 + Double.POSITIVE_INFINITY == Double.POSITIVE_INFINITY); // sanity check
assertEquals(new Double(Double.POSITIVE_INFINITY), new Double(1.0 + Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.POSITIVE_INFINITY), Double.valueOf(1.0 + Double.POSITIVE_INFINITY)); // sanity check

assertTrue(Duration.ONE.add(Duration.INDEFINITE).isIndefinite());
assertFalse(Duration.ONE.add(Duration.INDEFINITE).isUnknown());
}

@Test public void add_INDEFINITE_and_INDEFINITE_ResultsInIndefinite() {
//assertTrue(Double.POSITIVE_INFINITY + Double.POSITIVE_INFINITY == Double.POSITIVE_INFINITY); // sanity check
assertEquals(new Double(Double.POSITIVE_INFINITY), new Double(Double.POSITIVE_INFINITY + Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.POSITIVE_INFINITY), Double.valueOf(Double.POSITIVE_INFINITY + Double.POSITIVE_INFINITY)); // sanity check

assertTrue(Duration.INDEFINITE.add(Duration.INDEFINITE).isIndefinite());
assertFalse(Duration.INDEFINITE.add(Duration.INDEFINITE).isUnknown());
}

@Test public void add_UNKNOWN_and_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(Double.NaN + Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(Double.NaN + Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(Double.NaN + Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.UNKNOWN.add(Duration.INDEFINITE).isIndefinite());
assertTrue(Duration.UNKNOWN.add(Duration.INDEFINITE).isUnknown());
}

@Test public void add_ZERO_and_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(0.0 + Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(0.0 + Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(0.0 + Double.NaN)); // sanity check

assertFalse(Duration.ZERO.add(Duration.UNKNOWN).isIndefinite());
assertTrue(Duration.ZERO.add(Duration.UNKNOWN).isUnknown());
}

@Test public void add_ONE_and_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(1.0 + Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(1.0 + Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(1.0 + Double.NaN)); // sanity check

assertFalse(Duration.ONE.add(Duration.UNKNOWN).isIndefinite());
assertTrue(Duration.ONE.add(Duration.UNKNOWN).isUnknown());
@@ -381,7 +381,7 @@ public class DurationTest {

@Test public void subtract_ZERO_and_INDEFINITE_ResultsInNegativeInfinity() {
//assertTrue(0.0 - Double.POSITIVE_INFINITY == Double.NEGATIVE_INFINITY); // sanity check
assertEquals(new Double(Double.NEGATIVE_INFINITY), new Double(0.0 - Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NEGATIVE_INFINITY), Double.valueOf(0.0 - Double.POSITIVE_INFINITY)); // sanity check

final Duration result = Duration.ZERO.subtract(Duration.INDEFINITE);
assertFalse(result.isIndefinite());
@@ -391,7 +391,7 @@ public class DurationTest {

@Test public void subtract_ONE_and_INDEFINITE_ResultsInNegativeInfinity() {
//assertTrue(1.0 - Double.POSITIVE_INFINITY == Double.NEGATIVE_INFINITY); // sanity check
assertEquals(new Double(Double.NEGATIVE_INFINITY), new Double(1.0 - Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NEGATIVE_INFINITY), Double.valueOf(1.0 - Double.POSITIVE_INFINITY)); // sanity check

final Duration result = Duration.ONE.subtract(Duration.INDEFINITE);
assertFalse(result.isIndefinite());
@@ -401,31 +401,31 @@ public class DurationTest {

@Test public void subtract_INDEFINITE_and_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(Double.POSITIVE_INFINITY - Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(Double.POSITIVE_INFINITY - Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(Double.POSITIVE_INFINITY - Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.INDEFINITE.subtract(Duration.INDEFINITE).isIndefinite());
assertTrue(Duration.INDEFINITE.subtract(Duration.INDEFINITE).isUnknown());
}

@Test public void subtract_UNKNOWN_and_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(Double.NaN - Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(Double.NaN - Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(Double.NaN - Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.UNKNOWN.subtract(Duration.INDEFINITE).isIndefinite());
assertTrue(Duration.UNKNOWN.subtract(Duration.INDEFINITE).isUnknown());
}

@Test public void subtract_ZERO_and_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(0 - Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(0.0 - Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(0.0 - Double.NaN)); // sanity check

assertFalse(Duration.ZERO.subtract(Duration.UNKNOWN).isIndefinite());
assertTrue(Duration.ZERO.subtract(Duration.UNKNOWN).isUnknown());
}

@Test public void subtract_ONE_and_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(1.0 - Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(1.0 - Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(1.0 - Double.NaN)); // sanity check

assertFalse(Duration.ONE.subtract(Duration.UNKNOWN).isIndefinite());
assertTrue(Duration.ONE.subtract(Duration.UNKNOWN).isUnknown());
@@ -472,47 +472,47 @@ public class DurationTest {

@Test public void multiply_ZERO_and_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(0.0 * Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(0.0 * Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(0.0 * Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.ZERO.multiply(Double.POSITIVE_INFINITY).isIndefinite());
assertTrue(Duration.ZERO.multiply(Double.POSITIVE_INFINITY).isUnknown());
}

@Test public void multiply_ONE_and_INDEFINITE_ResultsInIndefinite() {
//assertTrue(1.0 * Double.POSITIVE_INFINITY == Double.POSITIVE_INFINITY); // sanity check
assertEquals(new Double(Double.POSITIVE_INFINITY), new Double(1.0 * Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.POSITIVE_INFINITY), Double.valueOf(1.0 * Double.POSITIVE_INFINITY)); // sanity check

assertTrue(Duration.ONE.multiply(Double.POSITIVE_INFINITY).isIndefinite());
assertFalse(Duration.ONE.multiply(Double.POSITIVE_INFINITY).isUnknown());
}

@Test public void multiply_INDEFINITE_and_INDEFINITE_ResultsInIndefinite() {
//assertTrue(Double.POSITIVE_INFINITY * Double.POSITIVE_INFINITY == Double.POSITIVE_INFINITY); // sanity check
assertEquals(new Double(Double.POSITIVE_INFINITY), new Double(Double.POSITIVE_INFINITY * Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.POSITIVE_INFINITY), Double.valueOf(Double.POSITIVE_INFINITY * Double.POSITIVE_INFINITY)); // sanity check

assertTrue(Duration.INDEFINITE.multiply(Double.POSITIVE_INFINITY).isIndefinite());
assertFalse(Duration.INDEFINITE.multiply(Double.POSITIVE_INFINITY).isUnknown());
}

@Test public void multiply_UNKNOWN_and_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(Double.NaN * Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(Double.NaN * Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(Double.NaN * Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.UNKNOWN.multiply(Double.POSITIVE_INFINITY).isIndefinite());
assertTrue(Duration.UNKNOWN.multiply(Double.POSITIVE_INFINITY).isUnknown());
}

@Test public void multiply_ZERO_and_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(0 * Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(0.0 * Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(0.0 * Double.NaN)); // sanity check

assertFalse(Duration.ZERO.multiply(Double.NaN).isIndefinite());
assertTrue(Duration.ZERO.multiply(Double.NaN).isUnknown());
}

@Test public void multiply_ONE_and_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(1.0 * Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(1.0 * Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(1.0 * Double.NaN)); // sanity check

assertFalse(Duration.ONE.multiply(Double.NaN).isIndefinite());
assertTrue(Duration.ONE.multiply(Double.NaN).isUnknown());
@@ -560,45 +560,45 @@ public class DurationTest {

@Test public void divide_ZERO_by_INDEFINITE_ResultsIn_ZERO() {
//assertTrue(0.0 / Double.POSITIVE_INFINITY == 0.0); // sanity check
assertEquals(new Double(0.0), new Double(0.0 / Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(0.0), Double.valueOf(0.0 / Double.POSITIVE_INFINITY)); // sanity check

assertSame(Duration.ZERO, Duration.ZERO.divide(Double.POSITIVE_INFINITY));
}

@Test public void divide_ONE_by_INDEFINITE_ResultsIn_ZERO() {
//assertTrue(1.0 / Double.POSITIVE_INFINITY == 0.0); // sanity check
assertEquals(new Double(0.0), new Double(1.0 / Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(0.0), Double.valueOf(1.0 / Double.POSITIVE_INFINITY)); // sanity check

assertSame(Duration.ZERO, Duration.ONE.divide(Double.POSITIVE_INFINITY));
}

@Test public void divide_INDEFINITE_by_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(Double.POSITIVE_INFINITY / Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(Double.POSITIVE_INFINITY / Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(Double.POSITIVE_INFINITY / Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.INDEFINITE.divide(Double.POSITIVE_INFINITY).isIndefinite());
assertTrue(Duration.INDEFINITE.divide(Double.POSITIVE_INFINITY).isUnknown());
}

@Test public void divide_UNKNOWN_by_INDEFINITE_ResultsInUnknown() {
assertTrue(Double.isNaN(Double.NaN / Double.POSITIVE_INFINITY)); // sanity check
assertEquals(new Double(Double.NaN), new Double(Double.NaN / Double.POSITIVE_INFINITY)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(Double.NaN / Double.POSITIVE_INFINITY)); // sanity check

assertFalse(Duration.UNKNOWN.divide(Double.POSITIVE_INFINITY).isIndefinite());
assertTrue(Duration.UNKNOWN.divide(Double.POSITIVE_INFINITY).isUnknown());
}

@Test public void divide_ZERO_by_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(0.0 / Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(0.0 / Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(0.0 / Double.NaN)); // sanity check

assertFalse(Duration.ZERO.divide(Double.NaN).isIndefinite());
assertTrue(Duration.ZERO.divide(Double.NaN).isUnknown());
}

@Test public void divide_ONE_by_UNKNOWN_ResultsInUnknown() {
assertTrue(Double.isNaN(1.0 / Double.NaN)); // sanity check
assertEquals(new Double(Double.NaN), new Double(1.0 / Double.NaN)); // sanity check
assertEquals(Double.valueOf(Double.NaN), Double.valueOf(1.0 / Double.NaN)); // sanity check

assertFalse(Duration.ONE.divide(Double.NaN).isIndefinite());
assertTrue(Duration.ONE.divide(Double.NaN).isUnknown());
@@ -517,7 +517,7 @@ private void updateMinorTickPath(Side side, double length) {
*/
@Override public T toRealValue(double value) {
//noinspection unchecked
return (T)new Double(value);
return (T)Double.valueOf(value);
}

// -------------- STYLESHEET HANDLING ------------------------------------------------------------------------------
@@ -85,8 +85,8 @@ public class XYChartDataTest {
@Test
public void testSeriesAddDelete() {
XYChart.Series<String, Number> series = new XYChart.Series<String, Number>();
Number value1 = new Integer(5);
Number value2 = new Integer(6);
Number value1 = 5;
Number value2 = 6;
XYChart.Data<String, Number> point1 = new XYChart.Data<String, Number>("Something", value1);
XYChart.Data<String, Number> point2 = new XYChart.Data<String, Number>("Something", value2);
series.getData().add(point1);

1 comment on commit 92d6232

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 92d6232 Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.