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

John Hendrikx jhendrikx at openjdk.org
Sun Feb 12 21:29:42 UTC 2023


On Sun, 12 Feb 2023 16:31:35 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> 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/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?

I guess this is fine, as for example `Function#identity()` also just returns `t -> t` instead of using a static final.

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

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


More information about the openjfx-dev mailing list