-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.3.0
-
None
-
Fix Understood
-
sparc
-
solaris_8
The javadoc for the "method" parameter of the "invoke" method of the java.lang.reflect.InvocationHandler interface currently reads as follows:
* @param method the <code>Method</code> instance corresponding to
* the interface method invoked on the proxy instance. The declaring
* class of the <code>Method</code> object will be the interface that
* the method was declared in, which may be a superinterface of the
* proxy interface that the proxy class inherits the method through.
This documentation is correct except in the case where the hashCode, equals, or toString methods of java.lang.Object are being dispatched to an InvocationHandler-- as described in this excerpt from the class documentation for java.lang.reflect.Proxy:
* <li>An invocation of the <code>hashCode</code>,
* <code>equals</code>, or <code>toString</code> methods declared in
* <code>java.lang.Object</code> on a proxy instance will be encoded and
* dispatched to the invocation handler's <code>invoke</code> method in
* the same manner as interface method invocations are encoded and
* dispatched, as described above. The declaring class of the
* <code>Method</code> object passed to <code>invoke</code> will be
* <code>java.lang.Object</code>.
-- in which case "method" will not be an interface method, and its class will be java.lang.Object instead of any interface.
The user could figure this out by reasonable interpretation of the phrase "in the same manner as interface method invocations are encoded and dispatched", but the documentation for this "method" argument should be clarified so that it describes all possibilities on its own.
* @param method the <code>Method</code> instance corresponding to
* the interface method invoked on the proxy instance. The declaring
* class of the <code>Method</code> object will be the interface that
* the method was declared in, which may be a superinterface of the
* proxy interface that the proxy class inherits the method through.
This documentation is correct except in the case where the hashCode, equals, or toString methods of java.lang.Object are being dispatched to an InvocationHandler-- as described in this excerpt from the class documentation for java.lang.reflect.Proxy:
* <li>An invocation of the <code>hashCode</code>,
* <code>equals</code>, or <code>toString</code> methods declared in
* <code>java.lang.Object</code> on a proxy instance will be encoded and
* dispatched to the invocation handler's <code>invoke</code> method in
* the same manner as interface method invocations are encoded and
* dispatched, as described above. The declaring class of the
* <code>Method</code> object passed to <code>invoke</code> will be
* <code>java.lang.Object</code>.
-- in which case "method" will not be an interface method, and its class will be java.lang.Object instead of any interface.
The user could figure this out by reasonable interpretation of the phrase "in the same manner as interface method invocations are encoded and dispatched", but the documentation for this "method" argument should be clarified so that it describes all possibilities on its own.
- relates to
-
JDK-4471738 Inconsistencies in method values in calls to InvocationHandler.invoke()
-
- Closed
-