APIdia Launch Partner
Top Description Inners Fields Constructors Methods
java.lang.invoke

pack-priv abstract non-sealed Class BoundMethodHandle

extends MethodHandle
Class Inheritance
Known Direct Subclasses
java.lang.invoke.BoundMethodHandle.Species_L, java.lang.invoke.SimpleMethodHandle
Annotations
@AOTSafeClassInitializer
Imports
jdk.internal.vm.annotation.AOTSafeClassInitializer, .Stable, java.util.ArrayList, .List

The flavor of method handle which is constructed with unmodifiable bound values, usable by lambda forms. For example, they can carry a configuration object for its lambda form, or carry an underlying method handle and its bound arguments for currying.

Each BMH class supports a number of values, each of a particular BasicType. This per-class value type and count information is recorded by SpeciesData. A Specializer manages lookup for any species.

Factories are provided by BoundMethodHandle.SpeciesData#factory(). Getters are exposed as BoundMethodHandle.SpeciesData#getter(int), which can be included as names in lambda forms.

SimpleMethodHandle (with no bound value) and Species_L (with a bound reference value) are explicitly provided to prevent bootstrap loops; the rest may be generated on demand, or may be pregenerated by GenerateJLIClassesHelper.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
private static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
pack-priv static final BoundMethodHandle.Specializer
Inherited from java.lang.invoke.MethodHandle:
form

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv final Object
arg(int i)

pack-priv BoundMethodHandle
bindArgumentD(int pos, double value)

pack-priv BoundMethodHandle
bindArgumentF(int pos, float value)

pack-priv BoundMethodHandle
bindArgumentI(int pos, int value)

pack-priv BoundMethodHandle
bindArgumentJ(int pos, long value)

pack-priv BoundMethodHandle
bindArgumentL(int pos, Object value)

Overrides java.lang.invoke.MethodHandle.bindArgumentL.

/ Implementation methods.

pack-priv static BoundMethodHandle
bindSingleD(MethodType type, LambdaForm form, double x)

pack-priv static BoundMethodHandle
bindSingleF(MethodType type, LambdaForm form, float x)

pack-priv static BoundMethodHandle
bindSingleI(MethodType type, LambdaForm form, int x)

pack-priv static BoundMethodHandle
bindSingleJ(MethodType type, LambdaForm form, long x)

pack-priv static BoundMethodHandle
pack-priv abstract BoundMethodHandle
copyWith(MethodType mt, LambdaForm lf)

Implements abstract java.lang.invoke.MethodHandle.copyWith.

/ Method handle implementation methods.

pack-priv abstract BoundMethodHandle
copyWithExtendD(MethodType mt, LambdaForm lf, double narg)

pack-priv abstract BoundMethodHandle
pack-priv abstract BoundMethodHandle
pack-priv abstract BoundMethodHandle
pack-priv abstract BoundMethodHandle
pack-priv LambdaFormEditor
pack-priv final int
fieldCount()

Return the number of fields in this BMH.

pack-priv Object
pack-priv final String
pack-priv static BoundMethodHandle
makeReinvoker(MethodHandle target)

A reinvoker MH has this form: lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }

pack-priv BoundMethodHandle
rebind()

Implements abstract java.lang.invoke.MethodHandle.rebind.

Require this method handle to be a BMH, or else replace it with a "wrapper" BMH.

pack-priv abstract BoundMethodHandle.SpeciesData
speciesData()

Return the BoundMethodHandle.SpeciesData instance representing this BMH species.

pack-priv static BoundMethodHandle.SpeciesData
pack-priv static BoundMethodHandle.SpeciesData
pack-priv static BoundMethodHandle.SpeciesData
pack-priv static BoundMethodHandle.SpeciesData
pack-priv static BoundMethodHandle.SpeciesData
pack-priv static BoundMethodHandle.SpeciesData
private boolean
Inherited from java.lang.invoke.MethodHandle:
asCollectorasCollectorasCollectorChecksasFixedArityasSpreaderasSpreaderasTypeasTypeUncachedasVarargsCollectorbindTocustomizedebugPrefixdebugStringdebugStringdescribeConstableinternalCallerClassinternalForminternalMemberNameinternalPropertiesintrinsicDataintrinsicNameinvokeinvokeBasicinvokeExactinvokeWithArgumentsinvokeWithArgumentsisCrackableisInvokeSpecialisVarargsCollectorlinkToInterfacelinkToNativelinkToSpeciallinkToStaticlinkToVirtualmaybeCustomizesetVarargsstandardStringtoStringtypeupdateFormviewAsTypeviewAsTypeCheckswithInternalMemberNamewithVarargs

Field Detail

FIELD_COUNT_THRESHOLDback to summary
private static final int FIELD_COUNT_THRESHOLD
FORM_EXPRESSION_THRESHOLDback to summary
private static final int FORM_EXPRESSION_THRESHOLD
SPECIALIZERback to summary
pack-priv static final BoundMethodHandle.Specializer SPECIALIZER

Constructor Detail

BoundMethodHandleback to summary
pack-priv BoundMethodHandle(MethodType type, LambdaForm form)

Method Detail

argback to summary
pack-priv final Object arg(int i)
bindArgumentDback to summary
pack-priv BoundMethodHandle bindArgumentD(int pos, double value)
bindArgumentFback to summary
pack-priv BoundMethodHandle bindArgumentF(int pos, float value)
bindArgumentIback to summary
pack-priv BoundMethodHandle bindArgumentI(int pos, int value)
bindArgumentJback to summary
pack-priv BoundMethodHandle bindArgumentJ(int pos, long value)
bindArgumentLback to summary
pack-priv BoundMethodHandle bindArgumentL(int pos, Object value)

Overrides java.lang.invoke.MethodHandle.bindArgumentL.

Doc from java.lang.invoke.MethodHandle.bindArgumentL.

/ Implementation methods. / Sub-classes can override these default implementations. / All these methods assume arguments are already validated.

Annotations
@Override
bindSingleDback to summary
pack-priv static BoundMethodHandle bindSingleD(MethodType type, LambdaForm form, double x)
bindSingleFback to summary
pack-priv static BoundMethodHandle bindSingleF(MethodType type, LambdaForm form, float x)
bindSingleIback to summary
pack-priv static BoundMethodHandle bindSingleI(MethodType type, LambdaForm form, int x)
bindSingleJback to summary
pack-priv static BoundMethodHandle bindSingleJ(MethodType type, LambdaForm form, long x)
bindSingleLback to summary
pack-priv static BoundMethodHandle bindSingleL(MethodType type, LambdaForm form, Object x)
copyWithback to summary
pack-priv abstract BoundMethodHandle copyWith(MethodType mt, LambdaForm lf)

Implements abstract java.lang.invoke.MethodHandle.copyWith.

Doc from java.lang.invoke.MethodHandle.copyWith.

/ Method handle implementation methods. / Sub-classes can override these default implementations. / All these methods assume arguments are already validated.

copyWithExtendDback to summary
pack-priv abstract BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg)
copyWithExtendFback to summary
pack-priv abstract BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg)
copyWithExtendIback to summary
pack-priv abstract BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg)
copyWithExtendJback to summary
pack-priv abstract BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg)
copyWithExtendLback to summary
pack-priv abstract BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg)
editorback to summary
pack-priv LambdaFormEditor editor()
fieldCountback to summary
pack-priv final int fieldCount()

Return the number of fields in this BMH. Equivalent to speciesData().fieldCount().

internalPropertiesback to summary
pack-priv Object internalProperties(int indentLevel)

Overrides java.lang.invoke.MethodHandle.internalProperties.

Annotations
@Override
internalValuesback to summary
pack-priv final String internalValues(int indentLevel)

Overrides java.lang.invoke.MethodHandle.internalValues.

Annotations
@Override
makeReinvokerback to summary
pack-priv static BoundMethodHandle makeReinvoker(MethodHandle target)

A reinvoker MH has this form: lambda (bmh, arg*) { thismh = bmh[0]; invokeBasic(thismh, arg*) }

rebindback to summary
pack-priv BoundMethodHandle rebind()

Implements abstract java.lang.invoke.MethodHandle.rebind.

Doc from java.lang.invoke.MethodHandle.rebind.

Require this method handle to be a BMH, or else replace it with a "wrapper" BMH. Many transforms are implemented only for BMHs.

Annotations
@Override
speciesDataback to summary
pack-priv abstract BoundMethodHandle.SpeciesData speciesData()

Return the BoundMethodHandle.SpeciesData instance representing this BMH species. All subclasses must provide a static field containing this value, and they must accordingly implement this method.

speciesData_Lback to summary
pack-priv static BoundMethodHandle.SpeciesData speciesData_L()
speciesData_LLback to summary
pack-priv static BoundMethodHandle.SpeciesData speciesData_LL()
speciesData_LLLback to summary
pack-priv static BoundMethodHandle.SpeciesData speciesData_LLL()
speciesData_LLLLback to summary
pack-priv static BoundMethodHandle.SpeciesData speciesData_LLLL()
speciesData_LLLLLback to summary
pack-priv static BoundMethodHandle.SpeciesData speciesData_LLLLL()
speciesDataForback to summary
pack-priv static BoundMethodHandle.SpeciesData speciesDataFor(LambdaForm form)
tooComplexback to summary
private boolean tooComplex()
java.lang.invoke back to summary

pack-priv final Class BoundMethodHandle.Specializer

extends ClassSpecializer<BoundMethodHandle, String, BoundMethodHandle.SpeciesData>
Class Inheritance
Annotations
@AOTSafeClassInitializer

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
BoundMethodHandle.Specializer.Factory

Generates concrete BMH classes.

Field Summary

Modifier and TypeField and Description
pack-priv static final List<MemberName>
private static final MemberName
pack-priv static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected BoundMethodHandle.Specializer.Factory
makeFactory()

Overrides java.lang.invoke.ClassSpecializer.makeFactory.

Hook that virtualizes the Factory class, allowing subclasses to extend it.

protected BoundMethodHandle.SpeciesData
protected String
Inherited from java.lang.invoke.ClassSpecializer:
baseConstructorTypeclassBCNameclassDescfactoryfindSpecieskeyTypemetaTypemethodDescreflectConstructorreflectFieldtopClasstopSpeciestransformMethods

Field Detail

BMH_TRANSFORMSback to summary
pack-priv static final List<MemberName> BMH_TRANSFORMS
SPECIES_DATA_ACCESSORback to summary
private static final MemberName SPECIES_DATA_ACCESSOR
TN_COPY_NO_EXTENDback to summary
pack-priv static final int TN_COPY_NO_EXTEND

Constructor Detail

Specializerback to summary
private Specializer()

Method Detail

makeFactoryback to summary
protected BoundMethodHandle.Specializer.Factory makeFactory()

Overrides java.lang.invoke.ClassSpecializer.makeFactory.

Doc from java.lang.invoke.ClassSpecializer.makeFactory.

Hook that virtualizes the Factory class, allowing subclasses to extend it.

Annotations
@Override
newSpeciesDataback to summary
protected BoundMethodHandle.SpeciesData newSpeciesData(String key)

Implements abstract java.lang.invoke.ClassSpecializer.newSpeciesData.

Annotations
@Override
topSpeciesKeyback to summary
protected String topSpeciesKey()

Overrides java.lang.invoke.ClassSpecializer.topSpeciesKey.

Annotations
@Override
java.lang.invoke back to summary

pack-priv Class BoundMethodHandle.Specializer.Factory

extends ClassSpecializer<BoundMethodHandle, String, BoundMethodHandle.SpeciesData>.Factory
Class Inheritance

Generates concrete BMH classes.

GenerateJLIClassesHelper can pre-generate species that are known to be loaded from MethodHandleStatics#traceSpeciesType.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected String
chooseFieldName(Class<?> type, int index)

Overrides java.lang.invoke.ClassSpecializer.Factory.chooseFieldName.

Field names in concrete species classes adhere to this pattern: type + index, where type is a single character (L, I, J, F, D).

Inherited from java.lang.invoke.ClassSpecializer.Factory:
findFactorygenerateConcreteSpeciesCodegenerateConcreteSpeciesCodeFilelinkCodeToSpeciesDatalinkSpeciesDataToCodeloadSpeciesloadSpeciesDataFromCodemakeNominalGetters

Constructor Detail

Factoryback to summary
pack-priv Factory()

Method Detail

chooseFieldNameback to summary
protected String chooseFieldName(Class<?> type, int index)

Overrides java.lang.invoke.ClassSpecializer.Factory.chooseFieldName.

Doc from java.lang.invoke.ClassSpecializer.Factory.chooseFieldName.

Field names in concrete species classes adhere to this pattern: type + index, where type is a single character (L, I, J, F, D). The factory subclass can customize this. The name is purely cosmetic, since it applies to a private field.

Annotations
@Override
java.lang.invoke back to summary

private final Class BoundMethodHandle.Species_L

extends BoundMethodHandle
Class Inheritance
Annotations
@AOTSafeClassInitializer

Field Summary

Modifier and TypeField and Description
pack-priv final Object
pack-priv static BoundMethodHandle.SpeciesData
Inherited from java.lang.invoke.BoundMethodHandle:
SPECIALIZER

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv final BoundMethodHandle
copyWith(MethodType mt, LambdaForm lf)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWith.

/ Method handle implementation methods.

pack-priv final BoundMethodHandle
pack-priv final BoundMethodHandle
pack-priv final BoundMethodHandle
pack-priv final BoundMethodHandle
pack-priv final BoundMethodHandle
pack-priv static BoundMethodHandle
pack-priv BoundMethodHandle.SpeciesData
speciesData()

Implements abstract java.lang.invoke.BoundMethodHandle.speciesData.

Return the BoundMethodHandle.SpeciesData instance representing this BMH species.

Inherited from java.lang.invoke.BoundMethodHandle:
argbindArgumentDbindArgumentFbindArgumentIbindArgumentJbindArgumentLbindSingleDbindSingleFbindSingleIbindSingleJbindSingleLeditorfieldCountinternalPropertiesinternalValuesmakeReinvokerrebindspeciesData_LspeciesData_LLspeciesData_LLLspeciesData_LLLLspeciesData_LLLLLspeciesDataFor

Field Detail

argL0back to summary
pack-priv final Object argL0
BMH_SPECIESback to summary
pack-priv static BoundMethodHandle.SpeciesData BMH_SPECIES
Annotations
@Stable

Constructor Detail

Species_Lback to summary
private Species_L(MethodType mt, LambdaForm lf, Object argL0)

Method Detail

copyWithback to summary
pack-priv final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWith.

Doc from java.lang.invoke.MethodHandle.copyWith.

/ Method handle implementation methods. / Sub-classes can override these default implementations. / All these methods assume arguments are already validated.

Annotations
@Override
copyWithExtendDback to summary
pack-priv final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWithExtendD.

Annotations
@Override
copyWithExtendFback to summary
pack-priv final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWithExtendF.

Annotations
@Override
copyWithExtendIback to summary
pack-priv final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWithExtendI.

Annotations
@Override
copyWithExtendJback to summary
pack-priv final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWithExtendJ.

Annotations
@Override
copyWithExtendLback to summary
pack-priv final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg)

Implements abstract java.lang.invoke.BoundMethodHandle.copyWithExtendL.

Annotations
@Override
makeback to summary
pack-priv static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0)
speciesDataback to summary
pack-priv BoundMethodHandle.SpeciesData speciesData()

Implements abstract java.lang.invoke.BoundMethodHandle.speciesData.

Doc from java.lang.invoke.BoundMethodHandle.speciesData.

Return the BoundMethodHandle.SpeciesData instance representing this BMH species. All subclasses must provide a static field containing this value, and they must accordingly implement this method.

Annotations
@Override
java.lang.invoke back to summary

pack-priv final Class BoundMethodHandle.SpeciesData

extends ClassSpecializer<BoundMethodHandle, String, BoundMethodHandle.SpeciesData>.SpeciesData
Class Inheritance
Annotations
@AOTSafeClassInitializer

Field Summary

Modifier and TypeField and Description
private final BoundMethodHandle.SpeciesData[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String
deriveClassName()

Overrides java.lang.invoke.ClassSpecializer.SpeciesData.deriveClassName.

Given a key, generate the name of the class which implements the species for that key.

protected List<Class<?>>
deriveFieldTypes(String key)

Implements abstract java.lang.invoke.ClassSpecializer.SpeciesData.deriveFieldTypes.

Given a key, derive the list of field types, which all instances of this species must store.

protected MethodHandle
deriveTransformHelper(MemberName transform, int whichtm)

Implements abstract java.lang.invoke.ClassSpecializer.SpeciesData.deriveTransformHelper.

Given the index of a method in the transforms list, supply a factory method that takes the arguments of the transform, plus the local fields, and produce a value of the required type.

protected <X> List<X>
deriveTransformHelperArguments(MemberName transform, int whichtm, List<X> args, List<X> fields)

Implements abstract java.lang.invoke.ClassSpecializer.SpeciesData.deriveTransformHelperArguments.

During code generation, this method is called once per transform to determine what is the mix of arguments to hand to the transform-helper.

protected String
deriveTypeString()

Overrides java.lang.invoke.ClassSpecializer.SpeciesData.deriveTypeString.

Default implementation collects basic type characters, plus possibly type names, if some types don't correspond to basic types.

pack-priv BoundMethodHandle.SpeciesData
private boolean
verifyTHAargs(MemberName transform, int whichtm, List<?> args, List<?> fields)

Inherited from java.lang.invoke.ClassSpecializer.SpeciesData:
deriveSuperClassequalsfactoryfieldCountfieldTypesgettergetterFunctiongetterFunctionsgettershashCodeisResolvedkeyouterspeciesCodetoStringtransformHelper

Field Detail

extensionsback to summary
private final BoundMethodHandle.SpeciesData[] extensions
Annotations
@Stable

Constructor Detail

SpeciesDataback to summary
public SpeciesData(BoundMethodHandle.Specializer outer, String key)

Method Detail

deriveClassNameback to summary
protected String deriveClassName()

Overrides java.lang.invoke.ClassSpecializer.SpeciesData.deriveClassName.

Doc from java.lang.invoke.ClassSpecializer.SpeciesData.deriveClassName.

Given a key, generate the name of the class which implements the species for that key. This algorithm must be stable.

Annotations
@Override
deriveFieldTypesback to summary
protected List<Class<?>> deriveFieldTypes(String key)

Implements abstract java.lang.invoke.ClassSpecializer.SpeciesData.deriveFieldTypes.

Doc from java.lang.invoke.ClassSpecializer.SpeciesData.deriveFieldTypes.

Given a key, derive the list of field types, which all instances of this species must store.

Annotations
@Override
deriveTransformHelperback to summary
protected MethodHandle deriveTransformHelper(MemberName transform, int whichtm)

Implements abstract java.lang.invoke.ClassSpecializer.SpeciesData.deriveTransformHelper.

Doc from java.lang.invoke.ClassSpecializer.SpeciesData.deriveTransformHelper.

Given the index of a method in the transforms list, supply a factory method that takes the arguments of the transform, plus the local fields, and produce a value of the required type. You can override this to return null or throw if there are no transforms. This method exists so that the transforms can be "grown" lazily. This is necessary if the transform *adds* a field to an instance, which sometimes requires the creation, on the fly, of an extended species. This method is only called once for any particular parameter. The species caches the result in a private array.

Annotations
@Override
deriveTransformHelperArgumentsback to summary
protected <X> List<X> deriveTransformHelperArguments(MemberName transform, int whichtm, List<X> args, List<X> fields)

Implements abstract java.lang.invoke.ClassSpecializer.SpeciesData.deriveTransformHelperArguments.

Doc from java.lang.invoke.ClassSpecializer.SpeciesData.deriveTransformHelperArguments.

During code generation, this method is called once per transform to determine what is the mix of arguments to hand to the transform-helper. The bytecode which marshals these arguments is open-coded in the species-specific transform. The two lists are of opaque objects, which you shouldn't do anything with besides reordering them into the output list. (They are both mutable, to make editing easier.) The imputed types of the args correspond to the transform's parameter list, while the imputed types of the fields correspond to the species field types. After code generation, this method may be called occasionally by error-checking code.

Annotations
@Override
deriveTypeStringback to summary
protected String deriveTypeString()

Overrides java.lang.invoke.ClassSpecializer.SpeciesData.deriveTypeString.

Doc from java.lang.invoke.ClassSpecializer.SpeciesData.deriveTypeString.

Default implementation collects basic type characters, plus possibly type names, if some types don't correspond to basic types.

Annotations
@Override
extendWithback to summary
pack-priv BoundMethodHandle.SpeciesData extendWith(LambdaForm.BasicType basicType)
verifyTHAargsback to summary
private boolean verifyTHAargs(MemberName transform, int whichtm, List<?> args, List<?> fields)