mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8180075: Javadoc of MethodHandles.Lookup::bind should note the difference from MethodHandle::bindTo
Reviewed-by: psandoz
This commit is contained in:
parent
f37c9fa5fb
commit
999aabdd77
1 changed files with 5 additions and 2 deletions
|
@ -1660,7 +1660,7 @@ assertEquals(""+l, (String) MH_this.invokeExact(subl)); // Listie method
|
|||
* (If the trailing array argument is the only argument,
|
||||
* the given receiver value will be bound to it.)
|
||||
* <p>
|
||||
* This is equivalent to the following code:
|
||||
* This is almost equivalent to the following code, with some differences noted below:
|
||||
* <blockquote><pre>{@code
|
||||
import static java.lang.invoke.MethodHandles.*;
|
||||
import static java.lang.invoke.MethodType.*;
|
||||
|
@ -1673,7 +1673,10 @@ return mh1;
|
|||
* where {@code defc} is either {@code receiver.getClass()} or a super
|
||||
* type of that class, in which the requested method is accessible
|
||||
* to the lookup class.
|
||||
* (Note that {@code bindTo} does not preserve variable arity.)
|
||||
* (Unlike {@code bind}, {@code bindTo} does not preserve variable arity.
|
||||
* Also, {@code bindTo} may throw a {@code ClassCastException} in instances where {@code bind} would
|
||||
* throw an {@code IllegalAccessException}, as in the case where the member is {@code protected} and
|
||||
* the receiver is restricted by {@code findVirtual} to the lookup class.)
|
||||
* @param receiver the object from which the method is accessed
|
||||
* @param name the name of the method
|
||||
* @param type the type of the method, with the receiver argument omitted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue