Udostępnij za pośrednictwem


MethodHandles.Lookup.UnreflectSpecial(Method, Class) Method

Definition

Produces a method handle for a reflected method.

[Android.Runtime.Register("unreflectSpecial", "(Ljava/lang/reflect/Method;Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)]
public Java.Lang.Invoke.MethodHandle UnreflectSpecial (Java.Lang.Reflect.Method m, Java.Lang.Class specialCaller);
[<Android.Runtime.Register("unreflectSpecial", "(Ljava/lang/reflect/Method;Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;", "", ApiSince=26)>]
member this.UnreflectSpecial : Java.Lang.Reflect.Method * Java.Lang.Class -> Java.Lang.Invoke.MethodHandle

Parameters

m
Method

the reflected method

specialCaller
Class

the class nominally calling the method

Returns

a method handle which can invoke the reflected method

Attributes

Remarks

Produces a method handle for a reflected method. It will bypass checks for overriding methods on the receiver, as if called from an invokespecial instruction from within the explicitly specified specialCaller. The type of the method handle will be that of the method, with a suitably restricted receiver type prepended. (The receiver type will be specialCaller or a subtype.) If the method's accessible flag is not set, access checking is performed immediately on behalf of the lookup class, as if invokespecial instruction were being linked.

Before method resolution, if the explicitly specified caller class is not identical with the lookup class, or if this lookup object does not have private access privileges, the access fails.

The returned method handle will have MethodHandle#asVarargsCollector variable arity if and only if the method's variable arity modifier bit (0x0080) is set.

Java documentation for java.lang.invoke.MethodHandles.Lookup.unreflectSpecial(java.lang.reflect.Method, java.lang.Class<?>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to