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

pack-priv abstract Class AbstractValidatingLambdaMetafactory

extends Object
Class Inheritance
Known Direct Subclasses
java.lang.invoke.InnerClassLambdaMetafactory
Imports
sun.invoke.util.Wrapper, java.lang.reflect.Modifier

Abstract implementation of a lambda metafactory which provides parameter unrolling and input validation.
See Also
LambdaMetafactory

Field Summary

Modifier and TypeField and Description
pack-priv final Class<?>[]
pack-priv final MethodType[]
pack-priv final MethodHandles.Lookup
pack-priv final MethodType
pack-priv final MethodType
pack-priv final Class<?>
pack-priv final MethodHandle
pack-priv final MethodHandleInfo
pack-priv final boolean
pack-priv final int
pack-priv final MethodType
pack-priv final Class<?>
pack-priv final String
pack-priv final MethodType
pack-priv final boolean
pack-priv final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv
AbstractValidatingLambdaMetafactory(MethodHandles.Lookup
Stacked automatically by VM; represents a lookup context with the accessibility privileges of the caller.
caller
,
MethodType
Stacked automatically by VM; the signature of the invoked method, which includes the expected static type of the returned lambda object, and the static types of the captured arguments for the lambda. In the event that the implementation method is an instance method, the first argument in the invocation signature will correspond to the receiver.
factoryType
,
String
Name of the method in the functional interface to which the lambda or method reference is being converted, represented as a String.
interfaceMethodName
,
MethodType
Type of the method in the functional interface to which the lambda or method reference is being converted, represented as a MethodType.
interfaceMethodType
,
MethodHandle
The implementation method which should be called (with suitable adaptation of argument types, return types, and adjustment for captured arguments) when methods of the resulting functional interface instance are invoked.
implementation
,
MethodType
The signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site
dynamicMethodType
,
boolean
Should the lambda be made serializable? If set, either the target type or one of the additional SAM types must extend Serializable.
isSerializable
,
Class<?>[]
Additional interfaces which the lambda object should implement.
altInterfaces
,
MethodType[]
Method types for additional signatures to be implemented by invoking the implementation method
altMethods
)

Meta-factory constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract CallSite

Returns:

a CallSite, which, when invoked, will return an instance of the functional interface
buildCallSite
()

Build the CallSite.

private void
checkDescriptor(MethodType descriptor)

Validate that the given descriptor's types are compatible with dynamicMethodType

private boolean

Returns:

True if 'fromType' can be passed to an argument of 'toType'
isAdaptableTo
(Class<?>
Type to convert from
fromType
,
Class<?>
Type to convert to
toType
,
boolean
If true, do strict checks, else allow that fromType may be parameterized
strict
)

Check type adaptability for parameter types.

private boolean

Returns:

True if 'fromType' can be converted to 'toType'
isAdaptableToAsReturn
(Class<?> fromType, Class<?> toType)

Check type adaptability for return types -- special handling of void type) and parameterized fromType

private boolean
isAdaptableToAsReturnStrict(Class<?> fromType, Class<?> toType)

pack-priv void
validateMetafactoryArgs()

Check the meta-factory arguments for errors

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

altInterfacesback to summary
pack-priv final Class<?>[] altInterfaces
altMethodsback to summary
pack-priv final MethodType[] altMethods
callerback to summary
pack-priv final MethodHandles.Lookup caller
dynamicMethodTypeback to summary
pack-priv final MethodType dynamicMethodType
factoryTypeback to summary
pack-priv final MethodType factoryType
implClassback to summary
pack-priv final Class<?> implClass
implementationback to summary
pack-priv final MethodHandle implementation
implInfoback to summary
pack-priv final MethodHandleInfo implInfo
implIsInstanceMethodback to summary
pack-priv final boolean implIsInstanceMethod
implKindback to summary
pack-priv final int implKind
implMethodTypeback to summary
pack-priv final MethodType implMethodType
interfaceClassback to summary
pack-priv final Class<?> interfaceClass
interfaceMethodNameback to summary
pack-priv final String interfaceMethodName
interfaceMethodTypeback to summary
pack-priv final MethodType interfaceMethodType
isSerializableback to summary
pack-priv final boolean isSerializable
targetClassback to summary
pack-priv final Class<?> targetClass

Constructor Detail

AbstractValidatingLambdaMetafactoryback to summary
pack-priv AbstractValidatingLambdaMetafactory(MethodHandles.Lookup caller, MethodType factoryType, String interfaceMethodName, MethodType interfaceMethodType, MethodHandle implementation, MethodType dynamicMethodType, boolean isSerializable, Class<?>[] altInterfaces, MethodType[] altMethods) throws LambdaConversionException

Meta-factory constructor.

Parameters
caller:MethodHandles.Lookup

Stacked automatically by VM; represents a lookup context with the accessibility privileges of the caller.

factoryType:MethodType

Stacked automatically by VM; the signature of the invoked method, which includes the expected static type of the returned lambda object, and the static types of the captured arguments for the lambda. In the event that the implementation method is an instance method, the first argument in the invocation signature will correspond to the receiver.

interfaceMethodName:String

Name of the method in the functional interface to which the lambda or method reference is being converted, represented as a String.

interfaceMethodType:MethodType

Type of the method in the functional interface to which the lambda or method reference is being converted, represented as a MethodType.

implementation:MethodHandle

The implementation method which should be called (with suitable adaptation of argument types, return types, and adjustment for captured arguments) when methods of the resulting functional interface instance are invoked.

dynamicMethodType:MethodType

The signature of the primary functional interface method after type variables are substituted with their instantiation from the capture site

isSerializable:boolean

Should the lambda be made serializable? If set, either the target type or one of the additional SAM types must extend Serializable.

altInterfaces:Class<?>[]

Additional interfaces which the lambda object should implement.

altMethods:MethodType[]

Method types for additional signatures to be implemented by invoking the implementation method

Exceptions
LambdaConversionException:
If any of the meta-factory protocol invariants are violated

Method Detail

buildCallSiteback to summary
pack-priv abstract CallSite buildCallSite() throws LambdaConversionException

Build the CallSite.

Returns:CallSite

a CallSite, which, when invoked, will return an instance of the functional interface

checkDescriptorback to summary
private void checkDescriptor(MethodType descriptor) throws LambdaConversionException

Validate that the given descriptor's types are compatible with dynamicMethodType

isAdaptableToback to summary
private boolean isAdaptableTo(Class<?> fromType, Class<?> toType, boolean strict)

Check type adaptability for parameter types.

Parameters
fromType:Class<?>

Type to convert from

toType:Class<?>

Type to convert to

strict:boolean

If true, do strict checks, else allow that fromType may be parameterized

Returns:boolean

True if 'fromType' can be passed to an argument of 'toType'

isAdaptableToAsReturnback to summary
private boolean isAdaptableToAsReturn(Class<?> fromType, Class<?> toType)

Check type adaptability for return types -- special handling of void type) and parameterized fromType

Returns:boolean

True if 'fromType' can be converted to 'toType'

isAdaptableToAsReturnStrictback to summary
private boolean isAdaptableToAsReturnStrict(Class<?> fromType, Class<?> toType)
validateMetafactoryArgsback to summary
pack-priv void validateMetafactoryArgs() throws LambdaConversionException

Check the meta-factory arguments for errors

Exceptions
LambdaConversionException:
if there are improper conversions