Missing throws declaration for NullPointerException in Proxy#getInvocationHandler
Alan Bateman
alan.bateman at oracle.com
Fri May 23 06:12:24 UTC 2025
On 22/05/2025 21:33, Kevin Bourrillion wrote:
> I think Steffen is almost certainly right that this was an accidental
> omission. That omission results in the `@throws IAE` line being
> *interpreted* as also applying to null, but I doubt it was ever meant
> that way.
>
> I think adding a `@throws NPE` is the right fix, and makes the class
> more consistent, and also preserves the ability to migrate the
> argument type to `Object!` in the future.
As Chen notes, long standing behavior (since at least 2006) has been to
throw NPE. Changing it to match an interpretation of the the IAE
description will be noticed, maybe even break something. So yes, I think
the NPE needs to be documented to align with the long standing behavior.
-Alan
More information about the core-libs-dev
mailing list