RFR: JDK-8298528: Clean up raw type warnings in base in bindings and collections packages [v2]
John Hendrikx
jhendrikx at openjdk.org
Tue Jan 3 11:03:58 UTC 2023
On Wed, 28 Dec 2022 20:16:51 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> John Hendrikx has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Clean up expression classes repeated null checks
>> - Use instanceof with pattern matching in a few spots
>
> modules/javafx.base/src/main/java/com/sun/javafx/collections/MappingChange.java line 38:
>
>> 36: private List<F> removed;
>> 37:
>> 38: private static final Map<?, ?> NOOP_MAP = new Map<>() {
>
> I think that we can do better with a bit of refactoring. The `Map` interface here is just `java.util.Function`. We can get rid of it and use `Function` instead. The `map` method call in `getRemoved` will be replaced with `apply`. The call sites needs just a little adjustment:
> * In `TableView::TableViewArrayListSelectionModel` the `cellToIndicesMap` needs to change its type to `Function`, but it is also unused (didn't look what it was supposed to be for), so no issue there.
> * In `TableView`, the method `fireCustomSelectedCellsListChangeEvent` needs to change its 2nd argument in the `MappingChange` constructor to `Function.indentity()` or something like `f -> f`.
> * Same changes for `TreeTableView`.
>
> I think that we can also use JavaFX's `Callback`, though I never use it if I can use `Function`.
Changed as suggested; I removed the unused fields.
-------------
PR: https://git.openjdk.org/jfx/pull/972
More information about the openjfx-dev
mailing list