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

Christopher Schnick duke at openjdk.org
Thu Jan 15 19:48:00 UTC 2026


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

>> I meant classname at hashcode, like "java.lang.Object at 36f6e879" may not be what you expect from `.get()`.  A `null` value is the original behavior.
>
> 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.

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

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


More information about the openjfx-dev mailing list