Skip to content

Commit a2196e2

Browse files
committed
4397513: Misleading "interface method" in InvocationHandler specification
Reviewed-by: alanb, jpai
1 parent ed36b9b commit a2196e2

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/java.base/share/classes/java/lang/reflect/InvocationHandler.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -54,41 +54,40 @@ public interface InvocationHandler {
5454
* @param proxy the proxy instance that the method was invoked on
5555
*
5656
* @param method the {@code Method} instance corresponding to
57-
* the interface method invoked on the proxy instance. The declaring
58-
* class of the {@code Method} object will be the interface that
59-
* the method was declared in, which may be a superinterface of the
60-
* proxy interface that the proxy class inherits the method through.
57+
* the method invoked on the proxy instance; the declaring
58+
* class of the {@code Method} object may be a proxy interface,
59+
* one of their superinterfaces, or the {@code Object} class
6160
*
6261
* @param args an array of objects containing the values of the
6362
* arguments passed in the method invocation on the proxy instance,
64-
* or {@code null} if interface method takes no arguments.
63+
* or {@code null} if the invoked method takes no arguments.
6564
* Arguments of primitive types are wrapped in instances of the
6665
* appropriate primitive wrapper class, such as
6766
* {@code java.lang.Integer} or {@code java.lang.Boolean}.
6867
*
6968
* @return the value to return from the method invocation on the
70-
* proxy instance. If the declared return type of the interface
69+
* proxy instance. If the declared return type of the invoked
7170
* method is a primitive type, then the value returned by
7271
* this method must be an instance of the corresponding primitive
7372
* wrapper class; otherwise, it must be a type assignable to the
7473
* declared return type. If the value returned by this method is
75-
* {@code null} and the interface method's return type is
74+
* {@code null} and the invoked method's return type is
7675
* primitive, then a {@code NullPointerException} will be
7776
* thrown by the method invocation on the proxy instance. If the
7877
* value returned by this method is otherwise not compatible with
79-
* the interface method's declared return type as described above,
78+
* the invoked method's declared return type as described above,
8079
* a {@code ClassCastException} will be thrown by the method
8180
* invocation on the proxy instance.
8281
*
8382
* @throws Throwable the exception to throw from the method
8483
* invocation on the proxy instance. The exception's type must be
8584
* assignable either to any of the exception types declared in the
86-
* {@code throws} clause of the interface method or to the
85+
* {@code throws} clause of the invoked method or to the
8786
* unchecked exception types {@code java.lang.RuntimeException}
8887
* or {@code java.lang.Error}. If a checked exception is
8988
* thrown by this method that is not assignable to any of the
9089
* exception types declared in the {@code throws} clause of
91-
* the interface method, then an
90+
* the invoked method, then an
9291
* {@link UndeclaredThrowableException} containing the
9392
* exception that was thrown by this method will be thrown by the
9493
* method invocation on the proxy instance.

0 commit comments

Comments
 (0)