RFR: JDK-8297414: Remove easy warnings in javafx.controls [v4]

Nir Lisker nlisker at openjdk.org
Wed Nov 23 22:44:36 UTC 2022


On Tue, 22 Nov 2022 18:54:39 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Note: I ran into a `javac` compiler bug while replacing types with diamond operators (ecj has no issues).  I had two options, add a `SuppressWarnings("unused")` or to use a lambda instead of a method reference to make `javac` happy.  I choose the later and added a comment so it can be fixed once the bug is fixed.  I've reported the issue here: https://bugs.openjdk.org/browse/JDK-8297428
>> 
>> - Remove unsupported/unnecessary SuppressWarning annotations
>> - Remove reduntant type specifications (use diamond operator)
>> - Remove unused or duplicate imports
>> - Remove unnecessary casts (type is already correct type or can be autoboxed)
>> - Remove unnecessary semi-colons (at end of class definitions, or just repeated ones)
>> - Remove redundant super interfaces (interface that is already inherited)
>> - Remove unused type parameters
>> - Remove declared checked exceptions that are never thrown
>> - Add missing `@Override` annotations
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert instanceof changes and replace with null checks

modules/javafx.controls/src/test/java/test/com/sun/javafx/scene/control/infrastructure/ControlSkinFactory.java line 287:

> 285:                 .map(d -> new Object[] {d, })
> 286:                 .collect(toList());
> 287:         return result;

According to the javadoc on this method, it's a hack for old Junit versions. Maybe it isn't needed anymore even. Leave as is for this PR anyway.

modules/javafx.controls/src/test/java/test/javafx/scene/chart/CategoryAxisTest.java line 122:

> 120: 
> 121:     @Test public void checkCategorySpacingReadOnlyCannotBind() {
> 122:         assertTrue(axis.categorySpacingProperty() instanceof ReadOnlyDoubleProperty);

In theory, this should be replaced with a `null` check, but if it's `null` the test will fail anyway, so it should be fine.

-------------

PR: https://git.openjdk.org/jfx/pull/959


More information about the openjfx-dev mailing list