jdk.dynalink.linker (Java SE 17 & JDK 17)
Description: declaration: module: jdk.dynalink, package: jdk.dynalink.linker
Keywords: jdk.dynalink.linker package

Module jdk.dynalink

# Package jdk.dynalink.linker

package jdk.dynalink.linker

Contains interfaces and classes needed by language runtimes to implement their own language-specific object models and type conversions. The main entry point is the `GuardingDynamicLinker` interface. It needs to be implemented in order to provide linking for the runtime's own object model. A language runtime can have more than one guarding dynamic linker implementation. When a runtime is configuring Dynalink for itself, it will normally set these guarding linkers as the prioritized linkers in its `DynamicLinkerFactory` (and maybe some of them as fallback linkers, for e.g. handling "method not found" and similar errors in a language-specific manner if no other linker managed to handle the operation.)

A language runtime that wishes to make at least some of its linkers available to other language runtimes for interoperability will need to use a `GuardingDynamicLinkerExporter`.

Most language runtimes will be able to implement their own linking logic by implementing `TypeBasedGuardingDynamicLinker` instead of `GuardingDynamicLinker`; it allows for faster type-based linking dispatch.

Language runtimes that allow type conversions other than those provided by Java will need to have their guarding dynamic linker (or linkers) also implement the `GuardingTypeConverterFactory` interface to provide the logic for these conversions.

Since:
  9

- Related Packages
  Package
  Description
  jdk.dynalink
  Contains interfaces and classes that are used to link an `invokedynamic` call site.
  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.
  jdk.dynalink.beans
  Contains the linker for ordinary Java objects.
  jdk.dynalink.support
  Contains classes that make using Dynalink more convenient by providing basic implementations of some classes as well as various utilities.
- Class
  Description
  ConversionComparator
  Optional interface to be implemented by `GuardingTypeConverterFactory` implementers.
  ConversionComparator.Comparison
  Enumeration of possible outcomes of comparing one conversion to another.
  GuardedInvocation
  Represents a conditionally valid method handle.
  GuardedInvocationTransformer
  Interface for objects that are used to transform one guarded invocation into another one.
  GuardingDynamicLinker
  The base interface for language-specific dynamic linkers.
  GuardingDynamicLinkerExporter
  A class acting as a supplier of guarding dynamic linkers that can be automatically loaded by other language runtimes.
  GuardingTypeConverterFactory
  Optional interface that can be implemented by `GuardingDynamicLinker` implementations to provide language-specific type conversion capabilities.
  LinkerServices
  Interface for services provided to `GuardingDynamicLinker` instances by the `DynamicLinker` that owns them.
  LinkRequest
  Represents a request to link a particular invocation at a particular call site.
  MethodHandleTransformer
  A generic interface describing operations that transform method handles.
  MethodTypeConversionStrategy
  Interface for objects representing a strategy for converting a method handle to a new type.
  TypeBasedGuardingDynamicLinker
  A guarding dynamic linker that can determine whether it can link the call site solely based on the type of the first argument at linking invocation time.