RFR: JDK-8298528: Clean up raw type warnings in base in bindings and collections packages [v4]

Nir Lisker nlisker at openjdk.org
Sun Feb 12 18:38:41 UTC 2023


On Wed, 8 Feb 2023 15:05:46 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Packages fixed:
>> - com.sun.javafx.binding
>> - com.sun.javafx.collections
>> - javafx.beans
>> - javafx.beans.binding
>> - javafx.collections
>> - javafx.collections.transformation
>
> John Hendrikx has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
> 
>  - Merge branch 'master' of https://git.openjdk.org/jfx into feature/fix-raw-type-warnings-in-base-2
>  - Undo changes in SortHelper
>  - Simplify MappingChange by using Function
>  - Clean up expression classes repeated null checks
>  - Use instanceof with pattern matching in a few spots
>  - Use static method for no-op map
>  - Fix raw type warnings in base
>    
>    Packages fixed:
>    - com.sun.javafx.binding
>    - com.sun.javafx.collections
>    - javafx.beans
>    - javafx.beans.binding
>    - javafx.collections
>    - javafx.collections.transformation

modules/javafx.base/src/main/java/javafx/collections/FXCollections.java line 235:

> 233:     }
> 234: 
> 235:     private static ObservableMap<?, ?> EMPTY_OBSERVABLE_MAP = new EmptyObservableMap<>();

This can be a `final` field. Same for the list and set ones. Not sure why it wasn't declared as such from the start.

modules/javafx.base/src/main/java/javafx/collections/transformation/FilteredList.java line 133:

> 131:             return getPredicate();
> 132:         }
> 133:         return (Predicate<E>) ALWAYS_TRUE;

Do we actually need the constant `ALWAYS_TRUE`? I think that just inlining `return e -> true;` is fine and we can remove the field, the cast, and the warning suppression. What do you think?

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

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


More information about the openjfx-dev mailing list