RFR: 8375016: Several catch blocks for NullPointerExceptions exist in the codebase [v5]

Andy Goryachev angorya at openjdk.org
Thu Jan 15 21:58:28 UTC 2026


On Thu, 15 Jan 2026 19:45:21 GMT, Christopher Schnick <duke at openjdk.org> wrote:

>> I am confused. Are you commenting on the right part of the diff? I don't see anything related to strings in this part
>
> Ah, I think I know what you mean now.
> 
> Since this is about the handling of generics, the original catch block should never be reached in my understanding. The generic T type is erased, meaning this method should always return the value, regardless of whether the type matches or not.
> 
> If you do assign the return value of this method to a String, and the returned value is not of type string, it will always throw a ClassCastException. But that should also happen for the old method with the catch block as well. The exception happens outside the method, that is the important part

my point this is not an equivalent change, because it changes the behavior.  Before the change, a null will be returned, after this change - a non-null value of some other class.

we don't want to change the scope of this PR, right?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2032#discussion_r2696094513


More information about the openjfx-dev mailing list