| Modifier and Type | Class and Description |
|---|---|
| private static record | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final ClassDesc | |
| private static final ClassDesc | |
| private static final AtomicInteger | |
| private static final List | |
| private static final ClassFileDumper | |
| private static final String | |
| private static final JavaLangReflectAccess | |
| private static final MethodType | |
| private static final MethodType | |
| private static final MethodType | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final MethodTypeDesc | |
| private static final ClassValue | |
| private static final String | |
| private static final String | |
| private static final Set |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private static void | |
| public static < the desired type of the wrapper, a single-method interface T> T | Returns: a correctly-typed wrapper for the given targeta class object representing intfc, final MethodHandle Tthe method handle to invoke from the wrapper target)Produces an instance of the given single-method interface which redirects its calls to the given method handle. |
| private static MethodHandle | |
| private static byte[] | Returns: the bytes of the implementation classesthe given interface ifaceDesc, String the name of the single abstract method methodName, List<MethodHandleProxies.the information for implementation methods methodsCreates an implementation class file for a given interface. |
| private static void | |
| private static Class | |
| private static boolean | |
| public static boolean | Returns: true if the reference is not null and points to an object produced byasInterfaceInstanceany reference x)Determines if the given object was produced by a call to |
| private static Module | newDynamicModule(ClassLoader ld, Set<Class<?>> types)
Create a dynamic module defined to the given class loader and has access to the given types. |
| private static Class | |
| private static String | |
| public static MethodHandle | Returns: a method handle implementing the unique methodany reference x)Produces or recovers a target method handle which is behaviorally equivalent to the unique method of this wrapper instance. |
| public static Class | Returns: the single-method interface type for which the wrapper was createdany reference x)Recovers the unique single-method interface type for which this wrapper instance was created. |
| CD_IllegalAccessException | back to summary |
|---|---|
| private static final ClassDesc CD_IllegalAccessException | |
| CD_UndeclaredThrowableException | back to summary |
|---|---|
| private static final ClassDesc CD_UndeclaredThrowableException | |
| counter | back to summary |
|---|---|
| private static final AtomicInteger counter | |
| DEFAULT_RETHROWS | back to summary |
|---|---|
| private static final List<ClassDesc> DEFAULT_RETHROWS | |
| DUMPER | back to summary |
|---|---|
| private static final ClassFileDumper DUMPER | |
| ENSURE_ORIGINAL_LOOKUP | back to summary |
|---|---|
| private static final String ENSURE_ORIGINAL_LOOKUP | |
| JLRA | back to summary |
|---|---|
| private static final JavaLangReflectAccess JLRA | |
| MT_MethodHandle_Object | back to summary |
|---|---|
| private static final MethodType MT_MethodHandle_Object | |
| MT_Object_Lookup_MethodHandle_MethodHandle | back to summary |
|---|---|
| private static final MethodType MT_Object_Lookup_MethodHandle_MethodHandle | |
| MT_void_Lookup_MethodHandle_MethodHandle | back to summary |
|---|---|
| private static final MethodType MT_void_Lookup_MethodHandle_MethodHandle | |
| MTD_Class | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_Class | |
| MTD_int | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_int | |
| MTD_MethodHandle_MethodType | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_MethodHandle_MethodType | |
| MTD_String | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_String | |
| MTD_void_Lookup | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_void_Lookup | |
| MTD_void_Lookup_MethodHandle_MethodHandle | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_void_Lookup_MethodHandle_MethodHandle | |
| MTD_void_String | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_void_String | |
| MTD_void_Throwable | back to summary |
|---|---|
| private static final MethodTypeDesc MTD_void_Throwable | |
| PROXIES | back to summary |
|---|---|
| private static final ClassValue<MethodHandleProxies. | |
| TARGET_NAME | back to summary |
|---|---|
| private static final String TARGET_NAME | |
| TYPE_NAME | back to summary |
|---|---|
| private static final String TYPE_NAME | |
| WRAPPER_TYPES | back to summary |
|---|---|
| private static final Set<Class<?>> WRAPPER_TYPES | |
| MethodHandleProxies | back to summary |
|---|---|
| private MethodHandleProxies() | |
| addElementType | back to summary |
|---|---|
| private static void addElementType(Set<Class<?>> types, Class<?> cls) | |
| addElementTypes | back to summary |
|---|---|
| private static void addElementTypes(Set<Class<?>> types, Class<?>... classes) | |
| asInterfaceInstance | back to summary |
|---|---|
| public static <T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) Produces an instance of the given single-method interface which redirects its calls to the given method handle.
A single-method interface is an interface which declares a uniquely named method.
When determining the uniquely named method of a single-method interface,
the public The interface must be public, not hidden, and not sealed. No additional access checks are performed.
The resulting instance of the required type will respond to
invocation of the type's uniquely named method by calling
the given target on the incoming arguments,
and returning or throwing whatever the target
returns or throws. The invocation will be as if by
The uniquely named method is allowed to be multiply declared,
with distinct type descriptors. (E.g., it can be overloaded,
or can possess bridge methods.) All such declarations are
connected directly to the target method handle.
Argument and return types are adjusted by
The wrapper instance will implement the requested interface
and its super-types, but no other single-method interfaces.
This means that the instance will not unexpectedly
pass an Implementation Note Therefore, each instance must implement a unique single-method interface.
Implementations may not bundle together
multiple single-method interfaces onto single implementation classes
in the style of
The method handle may throw an undeclared exception,
which means any checked exception (or other checked throwable)
not declared by the requested type's single abstract method.
If this happens, the throwable will be wrapped in an instance of
Like
Because of the possibility of bridge methods
and other corner cases, the interface may also have several abstract methods
with the same name but having distinct descriptors (types of returns and parameters).
In this case, all the methods are bound in common to the one given target.
The type check and effective Future versions of this API may accept additional types, such as abstract classes with single abstract methods. Future versions of this API may also equip wrapper instances with one or more additional public "marker" interfaces.
| |
| bindCaller | back to summary |
|---|---|
| private static MethodHandle bindCaller(MethodHandle target, Class<?> hostClass) | |
| createTemplate | back to summary |
|---|---|
| private static byte[] createTemplate(ClassLoader loader, ClassDesc proxyDesc, ClassDesc ifaceDesc, String methodName, List<MethodHandleProxies. Creates an implementation class file for a given interface. One implementation class is defined for each interface.
| |
| ensureAccess | back to summary |
|---|---|
| private static void ensureAccess(Module target, Class<?> c) | |
| getProxyClass | back to summary |
|---|---|
| private static Class | |
| isObjectMethod | back to summary |
|---|---|
| private static boolean isObjectMethod(Method m) | |
| isWrapperInstance | back to summary |
|---|---|
| public static boolean isWrapperInstance(Object x) Determines if the given object was produced by a call to
| |
| newDynamicModule | back to summary |
|---|---|
| private static Module newDynamicModule(ClassLoader ld, Set<Class<?>> types) Create a dynamic module defined to the given class loader and has access to the given types. The dynamic module contains only one single package named the same as the name of the dynamic module. It's not exported or open. | |
| newProxyClass | back to summary |
|---|---|
| private static Class | |
| nextModuleName | back to summary |
|---|---|
| private static String nextModuleName() | |
| wrapperInstanceTarget | back to summary |
|---|---|
| public static MethodHandle wrapperInstanceTarget(Object x) Produces or recovers a target method handle which is behaviorally
equivalent to the unique method of this wrapper instance.
The object
| |
| wrapperInstanceType | back to summary |
|---|---|
| public static Class Recovers the unique single-method interface type for which this wrapper instance was created.
The object
| |
| Modifier and Type | Field and Description |
|---|---|
| private final MethodTypeDesc | |
| private final String | fieldName
Record Component accessed by fieldName(). |
| private final List |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public MethodTypeDesc | |
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public String | |
| public final int | |
| public List | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| desc | back to summary |
|---|---|
| private final MethodTypeDesc desc Record Component accessed by desc(). | |
| fieldName | back to summary |
|---|---|
| private final String fieldName Record Component accessed by fieldName(). | |
| thrown | back to summary |
|---|---|
| private final List<ClassDesc> thrown Record Component accessed by thrown(). | |
| MethodInfo | back to summary |
|---|---|
| private MethodInfo(MethodTypeDesc desc, List<ClassDesc> thrown, String fieldName) | |
| desc | back to summary |
|---|---|
| public MethodTypeDesc desc() Record Component getter of desc. | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| fieldName | back to summary |
|---|---|
| public String fieldName() Record Component getter of fieldName. | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| thrown | back to summary |
|---|---|
| public List Record Component getter of thrown. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |
| Modifier and Type | Field and Description |
|---|---|
| private volatile WeakReference |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv T | |
| pack-priv void |
| ref | back to summary |
|---|---|
| private volatile WeakReference<T> ref | |
| WeakReferenceHolder | back to summary |
|---|---|
| pack-priv WeakReferenceHolder(T value) | |