-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
Adjusts specification to match longstanding actual behavior.
-
Java API
-
SE
Summary
Specify java.lang.reflect.Proxy::getInvocationHandler
throws a NullPointerException
instead of an IllegalArgumentException
if the input argument is null
.
Problem
Proxy.getInvocationHandler
specifies any non-proxy-instance arguments result in an IllegalArgumentException
. This does not match the actual behavior, that when null
is passed, a NullPointerException
is thrown.
Solution
Update the specification to match the actual behavior, which has been the case since the earliest OpenJDK history back in 2007.
Specification
diff --git a/src/java.base/share/classes/java/lang/reflect/Proxy.java b/src/java.base/share/classes/java/lang/reflect/Proxy.java
index 83a1520ce082f..1658d135cb3b4 100644
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java
@@ -967,6 +967,7 @@ public static boolean isProxyClass(Class<?> cl) {
* @return the invocation handler for the proxy instance
* @throws IllegalArgumentException if the argument is not a
* proxy instance
+ * @throws NullPointerException if {@code proxy} is {@code null}
*/
public static InvocationHandler getInvocationHandler(Object proxy)
throws IllegalArgumentException
- csr of
-
JDK-8357597 Proxy.getInvocationHandler throws NullPointerException instead of IllegalArgumentException for null
-
- Resolved
-