RFR: 8375016: Several catch blocks for NullPointerExceptions exist in the codebase [v5]
Christopher Schnick
duke at openjdk.org
Thu Jan 15 19:32:56 UTC 2026
On Thu, 15 Jan 2026 18:41:33 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Christopher Schnick has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix failing tests
>
> modules/javafx.base/src/main/java/com/sun/javafx/binding/SelectBinding.java line 97:
>
>> 95: // The type returned might be wrong, but this would not throw any ClassCastException here
>> 96: // Any casting issue would happen outside this method
>> 97: return (T) observable.getValue();
>
> so this is NOT an equivalent change, and therefore would need a deeper analysis - I, for example, can't tell if this change makes sense or not right away. Some objects' `toString()` value may not make sense.
>
> I would suggest to revert this change to keep the PR at the "light optimization" level.
I really didn't look into it that deeply, but from my understanding, there can't be an exception thrown for such a generic cast at runtime. At least not in the method itself. The class cast exception would happen at some point later after this method returns. But I am not an expert on generics.
I am not sure what you mean by the toString() comment though
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2032#discussion_r2695681118
More information about the openjfx-dev
mailing list