On Wed, 10 Mar 2021 19:49:25 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:
>> The following primitive constructors were deprecated in JDK 9 and are >> deprecated for removal in JDK 16. >> >> java.lang.Byte >> java.lang.Short >> java.lang.Integer >> java.lang.Long >> java.lang.Float >> java.lang.Double >> java.lang.Character >> java.lang.Boolean >> >> This change removes call to the primitive constructors with the `valueOf()` >> factory method of respective class. >> Calls like the following to create array get autoboxed so it does not >> require a change. >> >> `Double dArr[] = new Double[] {10.1, 20.2};` > > Ambarish Rapte has updated the pull request incrementally with one additional > commit since the last revision: > > correct Float.valueOf() I left some comments where I think autoboxing does the same work explicit boxing does. Unless I'm missing something, all these places can be simplified. apps/samples/Ensemble8/src/app/java/ensemble/samplepage/PieChartDataVisualizer.java line 92: > 90: } > 91: try { > 92: return (Double) Double.valueOf(string); Looks like an unnecessary cast. apps/toys/LayoutDemo/src/layout/CustomPane.java line 92: > 90: Collections.sort(sortedManagedChidlren, (c1, c2) > 91: -> Double.valueOf(c2.prefHeight(-1)).compareTo( > 92: Double.valueOf(c1.prefHeight(-1)))); This can be replaced with Collections.sort(sortedManagedChidlren, (c1, c2) -> Double.compare(c2.prefHeight(-1), c1.prefHeight(-1))); or Collections.sort(sortedManagedChidlren, Comparator.<Node>comparingDouble(n -> n.prefHeight(-1)).reversed()); I think. Same for the other places that do comparing. modules/javafx.controls/src/test/java/test/javafx/scene/control/MenuBarTest.java line 582: > 580: > 581: boolean click = true; > 582: final Boolean firstClick = Boolean.valueOf(click); Autobox? apps/samples/3DViewer/src/main/java/com/javafx/experiments/shape3d/SkinningMesh.java line 110: > 108: for (int i = 0; i < nPoints; i++) { > 109: if (weights[j][i] != 0.0f) { > 110: weightIndices[j].add(Integer.valueOf(i)); Autobox? apps/samples/Ensemble8/src/samples/java/ensemble/samples/language/swing/SampleTableModel.java line 54: > 52: {Double.valueOf(567), Double.valueOf(956), Double.valueOf(1154)}, > 53: {Double.valueOf(1292), Double.valueOf(1665), > Double.valueOf(1927)}, > 54: {Double.valueOf(1292), Double.valueOf(2559), Double.valueOf(2774)} Autobox? modules/javafx.base/src/test/java/test/com/sun/javafx/collections/MappingChangeTest.java line 52: > 50: @Test > 51: public void testAddRemove() { > 52: Change<Integer> change = new > NonIterableChange.SimpleRemovedChange<Integer>(0, 1, Integer.valueOf(5), > originalList); Autobox? modules/javafx.base/src/test/java/test/javafx/util/DurationTest.java line 289: > 287: @Test public void add_ZERO_and_INDEFINITE_ResultsInIndefinite() { > 288: //assertTrue(0.0 + Double.POSITIVE_INFINITY == > Double.POSITIVE_INFINITY); // sanity check > 289: assertEquals(Double.valueOf(Double.POSITIVE_INFINITY), > Double.valueOf(0.0 + Double.POSITIVE_INFINITY)); // sanity check I don't understand why convert to `Double` for the assertion test, but more than that, I don't understand why this test is needed for `Duration`. Isn't this is a guaranteed behavior of fp arithmetic? Same for all other such asserts. modules/javafx.controls/src/test/java/test/javafx/scene/chart/XYChartTest.java line 85: > 83: Font f = yaxis.getTickLabelFont(); > 84: // default caspian value for font size = 10 > 85: assertEquals(10, Double.valueOf(f.getSize()).intValue()); Any reason to convert `f.getSize()` to `int` and then to `Double`? Is it for flooring the `double`? Same for the other places. modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 643: > 641: ComboBox cb = new ComboBox(); > 642: StringConverter sc = cb.getConverter(); > 643: assertEquals("42", sc.toString(Integer.valueOf(42))); Autobox? modules/javafx.graphics/src/main/java/com/sun/prism/es2/X11GLFactory.java line 171: > 169: deviceDetails.put("XVisualID", > Long.valueOf(nGetVisualID(nativeCtxInfo))); > 170: deviceDetails.put("XDisplay", > Long.valueOf(nGetDisplay(nativeCtxInfo))); > 171: deviceDetails.put("XScreenID", > Integer.valueOf(nGetDefaultScreen(nativeCtxInfo))); Autobox? modules/javafx.graphics/src/main/java/com/sun/prism/j2d/J2DPipeline.java line 64: > 62: @Override > 63: public ResourceFactory getResourceFactory(Screen screen) { > 64: Integer index = Integer.valueOf(screen.getAdapterOrdinal()); Autobox? Same for the other similar places. modules/javafx.graphics/src/test/java/test/javafx/scene/NodeTest.java line 477: > 475: v.set(value); > 476: NodeTest.syncNode(node); > 477: assertTrue(numbersEquals(Integer.valueOf(value), Autobox? Same for similar places. modules/javafx.web/src/ios/java/javafx/scene/web/JSONDecoder.java line 101: > 99: long val = Long.parseLong(sNum); > 100: if ((val <= Integer.MAX_VALUE) && (Integer.MIN_VALUE <= > val)) { > 101: return Integer.valueOf(int) val); Autobox? ------------- PR: https://git.openjdk.java.net/jfx/pull/423