次の方法で共有


IMethodHandleInfo Interface

Definition

A symbolic reference obtained by cracking a direct method handle into its consitutent symbolic parts.

[Android.Runtime.Register("java/lang/invoke/MethodHandleInfo", "", "Java.Lang.Invoke.IMethodHandleInfoInvoker", ApiSince=26)]
public interface IMethodHandleInfo : Android.Runtime.IJavaObject, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("java/lang/invoke/MethodHandleInfo", "", "Java.Lang.Invoke.IMethodHandleInfoInvoker", ApiSince=26)>]
type IMethodHandleInfo = interface
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Attributes
Implements

Remarks

A symbolic reference obtained by cracking a direct method handle into its consitutent symbolic parts. To crack a direct method handle, call Lookup#revealDirect Lookup.revealDirect. <h1>"directmh">Direct Method Handles</h1> A <em>direct method handle</em> represents a method, constructor, or field without any intervening argument bindings or other transformations. The method, constructor, or field referred to by a direct method handle is called its <em>underlying member</em>. Direct method handles may be obtained in any of these ways: <ul> <li>By executing an ldc instruction on a CONSTANT_MethodHandle constant. (See the Java Virtual Machine Specification, sections 4.4.8 and 5.4.3.) <li>By calling one of the Lookup Factory Methods, such as Lookup#findVirtual Lookup.findVirtual, to resolve a symbolic reference into a method handle. A symbolic reference consists of a class, name string, and type. <li>By calling the factory method Lookup#unreflect Lookup.unreflect or Lookup#unreflectSpecial Lookup.unreflectSpecial to convert a Method into a method handle. <li>By calling the factory method Lookup#unreflectConstructor Lookup.unreflectConstructor to convert a Constructor into a method handle. <li>By calling the factory method Lookup#unreflectGetter Lookup.unreflectGetter or Lookup#unreflectSetter Lookup.unreflectSetter to convert a Field into a method handle. </ul>

<h1>Restrictions on Cracking</h1> Given a suitable Lookup object, it is possible to crack any direct method handle to recover a symbolic reference for the underlying method, constructor, or field. Cracking must be done via a Lookup object equivalent to that which created the target method handle, or which has enough access permissions to recreate an equivalent method handle.

If the underlying method is caller sensitive, the direct method handle will have been "bound" to a particular caller class, the java.lang.invoke.MethodHandles.Lookup#lookupClass() lookup class of the lookup object used to create it. Cracking this method handle with a different lookup class will fail even if the underlying method is public (like Class.forName).

The requirement of lookup object matching provides a "fast fail" behavior for programs which may otherwise trust erroneous revelation of a method handle with symbolic information (or caller binding) from an unexpected scope. Use java.lang.invoke.MethodHandles#reflectAs to override this limitation.

<h1>"refkinds">Reference kinds</h1> The Lookup Factory Methods correspond to all major use cases for methods, constructors, and fields. These use cases may be distinguished using small integers as follows: <table border=1 cellpadding=5 summary="reference kinds"> <tr><th>reference kind</th><th>descriptive name</th><th>scope</th><th>member</th><th>behavior</th></tr> <tr> <td>1</td><td>REF_getField</td><td>class</td> <td>FT f;</td><td>(T) this.f;</td> </tr> <tr> <td>2</td><td>REF_getStatic</td><td>class or interface</td> <td>static<br>FT f;</td><td>(T) C.f;</td> </tr> <tr> <td>3</td><td>REF_putField</td><td>class</td> <td>FT f;</td><td>this.f = x;</td> </tr> <tr> <td>4</td><td>REF_putStatic</td><td>class</td> <td>static<br>FT f;</td><td>C.f = arg;</td> </tr> <tr> <td>5</td><td>REF_invokeVirtual</td><td>class</td> <td>T m(A*);</td><td>(T) this.m(arg*);</td> </tr> <tr> <td>6</td><td>REF_invokeStatic</td><td>class or interface</td> <td>static<br>T m(A*);</td><td>(T) C.m(arg*);</td> </tr> <tr> <td>7</td><td>REF_invokeSpecial</td><td>class or interface</td> <td>T m(A*);</td><td>(T) super.m(arg*);</td> </tr> <tr> <td>8</td><td>REF_newInvokeSpecial</td><td>class</td> <td>C(A*);</td><td>new C(arg*);</td> </tr> <tr> <td>9</td><td>REF_invokeInterface</td><td>interface</td> <td>T m(A*);</td><td>(T) this.m(arg*);</td> </tr> </table>

Added in 1.8.

Java documentation for java.lang.invoke.MethodHandleInfo.

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.

Properties

DeclaringClass
Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
IsVarArgs

Determines if the underlying member was a variable arity method or constructor.

JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
MethodType
Modifiers
Name
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)
ReferenceKind

Methods

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
ReferenceKindToString(ReferenceKind)

Returns the descriptive name of the given reference kind, as defined in the table above.

RefKindIsField(ReferenceKind)

This member is deprecated.

RefKindIsValid(ReferenceKind)

This member is deprecated.

RefKindName(ReferenceKind)

This member is deprecated.

ReflectAs(Class, MethodHandles+Lookup)

Reflects the underlying member as a method, constructor, or field object.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
ToString(ReferenceKind, Class, String, MethodType)

Returns a string representation for a MethodHandleInfo, given the four parts of its symbolic reference.

UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to