RFR: JDK-8298200 Clean up raw type warnings in javafx.beans.property.* and com.sun.javafx.property.* [v2]
Nir Lisker
nlisker at openjdk.org
Fri Dec 9 18:10:10 UTC 2022
On Thu, 8 Dec 2022 14:21:45 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> - Added generics (to package private or internal classes only)
>> - Minor clean-ups of code I touched (naming)
>> - Fixed incorrect use of generics
>> - Fixed raw type warnings
>>
>> Note: some raw types have leaked into public API. These could be fixed without incompatibilities. For specifics see `JavaBeanObjectPropertyBuilder`. The javadoc would have the method signatures change (`<T>` would be appended to the affected methods). For now I've added a TODO there.
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>
> Revert renames in Disposer
I see that you moved the generic type declarations from the inner classes to the outer ones. I wasn't getting any raw type warnings on these. What requires these?
modules/javafx.base/src/main/java/com/sun/javafx/property/adapter/PropertyDescriptor.java line 177:
> 175: if (bean.equals(propertyChangeEvent.getSource()) && name.equals(propertyChangeEvent.getPropertyName())) {
> 176: final ReadOnlyJavaBeanProperty<T> property = checkRef();
> 177: if ((property instanceof Property) && (((Property<?>)property).isBound()) && !updating) {
This line can be
if ((property instanceof Property<?> prop) && prop.isBound() && !updating) {
with perhaps better naming.
modules/javafx.base/src/main/java/javafx/beans/property/ReadOnlyListProperty.java line 119:
> 117:
> 118: @SuppressWarnings("unchecked")
> 119: final List<E> list = (List<E>)obj; // safe cast as elements are only referenced
I'm not sure why it's safe to cast to a `List<E>`. You're getting a `List`, but it could be a list of something else. In the `Map` and `Set` variants there is a try-catch for casting exceptions.
-------------
PR: https://git.openjdk.org/jfx/pull/969
More information about the openjfx-dev
mailing list