Uses of Class java.lang.invoke.MethodHandles.Lookup (Java SE 23 & JDK 23)
Description: use: module: java.base, package: java.lang.invoke, class: MethodHandles, class: Lookup

# Uses of Class
java.lang.invoke.MethodHandles.Lookup

Packages that use MethodHandles.Lookup
Package
Description
java.lang
Provides classes that are fundamental to the design of the Java programming language.
java.lang.classfile
Provides classfile parsing, generation, and transformation library.
java.lang.constant
Classes and interfaces to represent nominal descriptors for run-time entities such as classes or method handles, and classfile entities such as constant pool entries or `invokedynamic` call sites.
java.lang.invoke
The `java.lang.invoke` package provides low-level primitives for interacting with the Java Virtual Machine.
java.lang.runtime
The `java.lang.runtime` package provides low-level runtime support for the Java language.
jdk.dynalink
Contains interfaces and classes that are used to link an `invokedynamic` call site.
jdk.dynalink.linker
Contains interfaces and classes needed by language runtimes to implement their own language-specific object models and type conversions.
jdk.dynalink.linker.support
Contains classes that make it more convenient for language runtimes to implement their own language-specific object models and type conversions by providing basic implementations of some classes as well as various utilities.

- ## Uses of MethodHandles.Lookup in java.lang

  Methods in java.lang with parameters of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `Double`
  Double.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this instance as a `ConstantDesc`, the result of which is the instance itself.
  `Float`
  Float.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this instance as a `ConstantDesc`, the result of which is the instance itself.
  `Integer`
  Integer.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this instance as a `ConstantDesc`, the result of which is the instance itself.
  `Long`
  Long.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this instance as a `ConstantDesc`, the result of which is the instance itself.
  `String`
  String.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this instance as a `ConstantDesc`, the result of which is the instance itself.

- ## Uses of MethodHandles.Lookup in java.lang.classfilePREVIEW

  Methods in java.lang.classfilePREVIEW with parameters of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `static ClassHierarchyResolverPREVIEW`
  ClassHierarchyResolver.`ofClassLoading(MethodHandles.Lookup lookup)`
  Returns a ClassHierarchyResolver that extracts class hierarchy information via the Reflection API with a Lookup.

- ## Uses of MethodHandles.Lookup in java.lang.constant

  Methods in java.lang.constant with parameters of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `CallSite`
  DynamicCallSiteDesc.`resolveCallSiteDesc(MethodHandles.Lookup lookup)`
  Reflectively invokes the bootstrap method with the specified arguments, and return the resulting `CallSite`
  `Class<?>`
  ClassDesc.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  `Object`
  ConstantDesc.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4.
  `T`
  DynamicConstantDesc.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  `MethodHandle`
  MethodHandleDesc.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  `MethodType`
  MethodTypeDesc.`resolveConstantDesc(MethodHandles.Lookup lookup)`
  Resolves this descriptor reflectively, emulating the resolution behavior of JVMS 5.4.3 and the access control behavior of JVMS 5.4.4.

- ## Uses of MethodHandles.Lookup in java.lang.invoke

  Methods in java.lang.invoke that return MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `MethodHandles.Lookup`
  MethodHandles.Lookup.`defineHiddenClass(byte[] bytes, boolean initialize, MethodHandles.Lookup.ClassOption... options)`
  Creates a hidden class or interface from `bytes`, returning a `Lookup` on the newly created class or interface.
  `MethodHandles.Lookup`
  MethodHandles.Lookup.`defineHiddenClassWithClassData(byte[] bytes, Object classData, boolean initialize, MethodHandles.Lookup.ClassOption... options)`
  Creates a hidden class or interface from `bytes` with associated class data, returning a `Lookup` on the newly created class or interface.
  `MethodHandles.Lookup`
  MethodHandles.Lookup.`dropLookupMode(int modeToDrop)`
  Creates a lookup on the same lookup class which this lookup object finds members, but with a lookup mode that has lost the given lookup mode.
  `MethodHandles.Lookup`
  MethodHandles.Lookup.`in(Class<?> requestedLookupClass)`
  Creates a lookup on the specified new lookup class.
  `static MethodHandles.Lookup`
  MethodHandles.`lookup()`
  Returns a `lookup object` with full capabilities to emulate all supported bytecode behaviors of the caller.
  `static MethodHandles.Lookup`
  MethodHandles.`privateLookupIn(Class<?> targetClass, MethodHandles.Lookup caller)`
  Returns a `lookup` object on a target class to emulate all supported bytecode behaviors, including private access.
  `static MethodHandles.Lookup`
  MethodHandles.`publicLookup()`
  Returns a `lookup object` which is trusted minimally.
  Methods in java.lang.invoke with parameters of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `static CallSite`
  LambdaMetafactory.`altMetafactory(MethodHandles.Lookup caller, String interfaceMethodName, MethodType factoryType, Object... args)`
  Facilitates the creation of simple "function objects" that implement one or more interfaces by delegation to a provided `MethodHandle`, after appropriate type adaptation and partial evaluation of arguments.
  `static VarHandle`
  ConstantBootstraps.`arrayVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> arrayClass)`
  Finds a `VarHandle` for an array type.
  `static <T> T`
  MethodHandles.`classData(MethodHandles.Lookup caller, String name, Class<T> type)`
  Returns the class data associated with the lookup class of the given `caller` lookup object, or `null`.
  `static <T> T`
  MethodHandles.`classDataAt(MethodHandles.Lookup caller, String name, Class<T> type, int index)`
  Returns the element at the specified index in the class data, if the class data associated with the lookup class of the given `caller` lookup object is a `List`.
  `static <E extends Enum<E>>
  E`
  ConstantBootstraps.`enumConstant(MethodHandles.Lookup lookup, String name, Class<E> type)`
  Returns an `enum` constant of the type specified by `type` with the name specified by `name`.
  `static Object`
  ConstantBootstraps.`explicitCast(MethodHandles.Lookup lookup, String name, Class<?> dstType, Object value)`
  Applies a conversion from a source type to a destination type.
  `static VarHandle`
  ConstantBootstraps.`fieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> declaringClass, Class<?> fieldType)`
  Finds a `VarHandle` for an instance field.
  `static Object`
  ConstantBootstraps.`getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type)`
  Returns the value of a static final field declared in the class which is the same as the field's type (or, for primitive-valued fields, declared in the wrapper class.)
  `static Object`
  ConstantBootstraps.`getStaticFinal(MethodHandles.Lookup lookup, String name, Class<?> type, Class<?> declaringClass)`
  Returns the value of a static final field.
  `static Object`
  ConstantBootstraps.`invoke(MethodHandles.Lookup lookup, String name, Class<?> type, MethodHandle handle, Object... args)`
  Returns the result of invoking a method handle with the provided arguments.
  `static CallSite`
  StringConcatFactory.`makeConcat(MethodHandles.Lookup lookup, String name, MethodType concatType)`
  Facilitates the creation of optimized String concatenation methods, that can be used to efficiently concatenate a known number of arguments of known types, possibly after type adaptation and partial evaluation of arguments.
  `static CallSite`
  StringConcatFactory.`makeConcatWithConstants(MethodHandles.Lookup lookup, String name, MethodType concatType, String recipe, Object... constants)`
  Facilitates the creation of optimized String concatenation methods, that can be used to efficiently concatenate a known number of arguments of known types, possibly after type adaptation and partial evaluation of arguments.
  `static CallSite`
  LambdaMetafactory.`metafactory(MethodHandles.Lookup caller, String interfaceMethodName, MethodType factoryType, MethodType interfaceMethodType, MethodHandle implementation, MethodType dynamicMethodType)`
  Facilitates the creation of simple "function objects" that implement one or more interfaces by delegation to a provided `MethodHandle`, after appropriate type adaptation and partial evaluation of arguments.
  `static Object`
  ConstantBootstraps.`nullConstant(MethodHandles.Lookup lookup, String name, Class<?> type)`
  Returns a `null` object reference for the reference type specified by `type`.
  `static Class<?>`
  ConstantBootstraps.`primitiveClass(MethodHandles.Lookup lookup, String name, Class<?> type)`
  Returns a `Class` mirror for the primitive type whose type descriptor is specified by `name`.
  `static MethodHandles.Lookup`
  MethodHandles.`privateLookupIn(Class<?> targetClass, MethodHandles.Lookup caller)`
  Returns a `lookup` object on a target class to emulate all supported bytecode behaviors, including private access.
  `<T extends Member>
  T`
  MethodHandleInfo.`reflectAs(Class<T> expected, MethodHandles.Lookup lookup)`
  Reflects the underlying member as a method, constructor, or field object.
  `static VarHandle`
  ConstantBootstraps.`staticFieldVarHandle(MethodHandles.Lookup lookup, String name, Class<VarHandle> type, Class<?> declaringClass, Class<?> fieldType)`
  Finds a `VarHandle` for a static field.

- ## Uses of MethodHandles.Lookup in java.lang.runtime

  Methods in java.lang.runtime with parameters of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `static Object`
  ObjectMethods.`bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type, Class<?> recordClass, String names, MethodHandle... getters)`
  Bootstrap method to generate the `Object.equals(Object)`, `Object.hashCode()`, and `Object.toString()` methods, based on a description of the component names and accessor methods, for either `invokedynamic` call sites or dynamic constant pool entries.
  `static CallSite`
  SwitchBootstraps.`enumSwitch(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, Object... labels)`
  Bootstrap method for linking an `invokedynamic` call site that implements a `switch` on a target of an enum type.
  `static CallSite`
  SwitchBootstraps.`typeSwitch(MethodHandles.Lookup lookup, String invocationName, MethodType invocationType, Object... labels)`
  Bootstrap method for linking an `invokedynamic` call site that implements a `switch` on a target of a reference type.

- ## Uses of MethodHandles.Lookup in jdk.dynalink

  Methods in jdk.dynalink that return MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `final MethodHandles.Lookup`
  SecureLookupSupplier.`getLookup()`
  Returns the lookup secured by this `SecureLookupSupplier`.
  `protected final MethodHandles.Lookup`
  SecureLookupSupplier.`getLookupPrivileged()`
  Returns the value of `SecureLookupSupplier.getLookup()` without a security check.
  Constructors in jdk.dynalink with parameters of type MethodHandles.Lookup
  Modifier
  Constructor
  Description
  ``
  `CallSiteDescriptor(MethodHandles.Lookup lookup, Operation operation, MethodType methodType)`
  Creates a new call site descriptor.
  ``
  `SecureLookupSupplier(MethodHandles.Lookup lookup)`
  Creates a new secure lookup supplier, securing the passed lookup.

- ## Uses of MethodHandles.Lookup in jdk.dynalink.linker

  Method parameters in jdk.dynalink.linker with type arguments of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `GuardedInvocation`
  GuardingTypeConverterFactory.`convertToType(Class<?> sourceType, Class<?> targetType, Supplier<MethodHandles.Lookup> lookupSupplier)`
  Returns a guarded type conversion that receives a value of the specified source type and returns a value converted to the specified target type.

- ## Uses of MethodHandles.Lookup in jdk.dynalink.linker.support

  Methods in jdk.dynalink.linker.support with parameters of type MethodHandles.Lookup
  Modifier and Type
  Method
  Description
  `static MethodHandle`
  Lookup.`findOwnSpecial(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes)`
  Given a lookup, finds using `Lookup.findSpecial(Class, String, MethodType)` a method on that lookup's class.
  `static MethodHandle`
  Lookup.`findOwnStatic(MethodHandles.Lookup lookup, String name, Class<?> rtype, Class<?>... ptypes)`
  Given a lookup, finds using `Lookup.findStatic(Class, String, MethodType)` a method on that lookup's class.
  `static MethodHandle`
  Lookup.`unreflect(MethodHandles.Lookup lookup, Method m)`
  Performs a `unreflect(Method)`, converting any encountered `IllegalAccessException` into an `IllegalAccessError`.
  `static MethodHandle`
  Lookup.`unreflectConstructor(MethodHandles.Lookup lookup, Constructor<?> c)`
  Performs a `unreflectConstructor(Constructor)`, converting any encountered `IllegalAccessException` into an `IllegalAccessError`.
  Constructors in jdk.dynalink.linker.support with parameters of type MethodHandles.Lookup
  Modifier
  Constructor
  Description
  ``
  `Lookup(MethodHandles.Lookup lookup)`
  Creates a new instance, bound to an instance of `MethodHandles.Lookup`.