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
Imports
jdk.internal.vm.annotation.Stable, java.util.ArrayList, .List

The flavor of method handle which emulates an invoke instruction on a predetermined argument. The JVM dispatches to the correct method when the handle is created, not when it is invoked. All bound arguments are encapsulated in dedicated species.

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
pack-priv static BoundMethodHandle
pack-priv abstract BoundMethodHandle
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.

Annotations
@Override
bindSingleback to summary
pack-priv static BoundMethodHandle bindSingle(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.

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.

Returns:BoundMethodHandle

a behaviorally equivalent BMH

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

Nested and Inner Type Summary

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

Generation of 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:
baseConstructorTypeclassBCNameclassBCNameclassNameclassSigclassSigfactoryfindSpecieskeyTypemetaTypemethodSigreflectConstructorreflectFieldtopClasstopSpeciestransformMethods

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

Generation of concrete BMH classes. A concrete BMH species is fit for binding a number of values adhering to a given type pattern. Reference types are erased. BMH species are cached by type pattern. A BMH species has a number of fields with the concrete (possibly erased) types of bound values. Setters are provided as an API in BMH. Getters are exposed as MHs, which can be included as names in lambda forms.

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

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
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:
argbindArgumentDbindArgumentFbindArgumentIbindArgumentJbindArgumentLbindSingleeditorfieldCountinternalPropertiesinternalValuesmakeReinvokerrebindspeciesData_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.

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

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
the transform being implemented
transform
,
int
the index of that transform in the original list of transforms
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
the transform being implemented
transform
,
int
the index of that transform in the original list of transforms
whichtm
,
List<X>
a list of opaque objects representing the incoming transform arguments
args
,
List<X>
a list of opaque objects representing the field values of the receiver
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.

Returns:String

class name, which by default is outer().topClass().getName() + "$Species_" + deriveTypeString(key)

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.

Parameters
transform:MemberName

the transform being implemented

whichtm:int

the index of that transform in the original list of transforms

Returns:MethodHandle

the method handle which creates a new result from a mix of transform arguments and field values

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.

Parameters
<X>
the common element type of the various lists
transform:MemberName

the transform being implemented

whichtm:int

the index of that transform in the original list of transforms

args:List<X>

a list of opaque objects representing the incoming transform arguments

fields:List<X>

a list of opaque objects representing the field values of the receiver

Returns:List<X>

a new list

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.

Returns:String

a string suitable for use in a class name

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)