Review Request: JDK-8209005: Lookup.unreflectSpecial fails for default methods when Lookup.findSpecial works

Daniel Fuchs daniel.fuchs at oracle.com
Tue Aug 13 09:02:58 UTC 2019


Hi Mandy,

This looks good to me.

best regards,

-- daniel

On 31/07/2019 21:59, Mandy Chung wrote:
> Hi Peter, Daniel

[...]

> This is correct when this class is a subclass of C.   A slight 
> clarification to indicate that aMethod's declaring class is C might 
> help.  I also fixed another typo:
> 
> --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
> +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
> @@ -334,7 +334,7 @@
>        * </tr>
>        * <tr>
>        *     <th scope="row">{@link java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}</th>
> -     *     <td>{@code static}<br>{@code FT f;}</td><td>{@code (T) C.f;}</td>
> +     *     <td>{@code static}<br>{@code FT f;}</td><td>{@code (FT) C.f;}</td>
>        * </tr>
>        * <tr>
>        *     <th scope="row">{@link java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}</th>
> @@ -377,8 +377,8 @@
>        *     <td>{@code C(A*);}</td><td>{@code (C) aConstructor.newInstance(arg*);}</td>
>        * </tr>
>        * <tr>
> -     *     <th scope="row">{@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}</th>
> -     *     <td>({@code static})?<br>{@code T m(A*);}</td><td>{@code (T) aMethod.invoke(thisOrNull, arg*);}</td>
> +     *     <th scope="row">{@link java.lang.invoke.MethodHandles.Lookup#unreflectSpecial lookup.unreflectSpecial(aMethod,this.class)}</th>
> +     *     <td>{@code T m(A*);}</td><td>{@code (T) super.m(arg*);}</td>
>        * </tr>
>        * <tr>
>        *     <th scope="row">{@link java.lang.invoke.MethodHandles.Lookup#findClass lookup.findClass("C")}</th>
> @@ -403,7 +403,7 @@
>        * stands for a null reference if the accessed method or field is static,
>        * and {@code this} otherwise.
>        * The names {@code aMethod}, {@code aField}, and {@code aConstructor} stand
> -     * for reflective objects corresponding to the given members.
> +     * for reflective objects corresponding to the given members declared in type {@code C}.
>        * <p>
>        * The bytecode behavior for a {@code findClass} operation is a load of a constant class,
>        * as if by {@code ldc CONSTANT_Class}.
> 
> 
> Thanks.
> Mandy



More information about the core-libs-dev mailing list