Hello, I have created https://bugs.openjdk.org/browse/JDK-8357597 for this.
Your analysis isn't quite correct - if you look at the method documentation, 
you would anticipate this to fail with an IllegalArgumentException instead of a 
NullPointerException. However, this mismatch has been there since 2006, so it's 
best to update the docs to match the actual longstanding behavior.
P.S. In the future, you can also report bugs via https://bugs.java.com/

Regard, Chen
________________________________
From: core-libs-dev <core-libs-dev-r...@openjdk.org> on behalf of Steffen 
Nießing <zuniq...@protonmail.com>
Sent: Thursday, May 22, 2025 1:12 PM
To: core-libs-dev@openjdk.org <core-libs-dev@openjdk.org>
Subject: Missing throws declaration for NullPointerException in 
Proxy#getInvocationHandler

Hi,

recently I've come across the documentation of 
Proxy#getInvocationHandler(Object) and recognized that there's a missing throws 
declaration for a NullPointerException. The expression 
Proxy.getInvocationHandler(null) fails, because proxy.getClass() is called 
without asserting that proxy is not null.

I'd be happy to provide the JavaDoc update, if anyone would like to sponsor me 
the JBS issue for this one.

Cheers
Steffen

Reply via email to