public class LambdaDeserializer$
extends java.lang.Object
$deserializeLambda$
method that the Scala 2.12
compiler will add to classes hosting lambdas.
It is not intended to be consumed directly.
Modifier and Type | Field and Description |
---|---|
static LambdaDeserializer$ |
MODULE$
Static reference to the singleton instance of this Scala object.
|
Constructor and Description |
---|
LambdaDeserializer$() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
deserializeLambda(java.lang.invoke.MethodHandles.Lookup lookup,
java.util.Map<java.lang.String,java.lang.invoke.MethodHandle> cache,
java.lang.invoke.SerializedLambda serialized)
Deserialize a lambda by calling
LambdaMetafactory.altMetafactory to spin up a lambda class
and instantiating this class with the captured arguments. |
public static final LambdaDeserializer$ MODULE$
public java.lang.Object deserializeLambda(java.lang.invoke.MethodHandles.Lookup lookup, java.util.Map<java.lang.String,java.lang.invoke.MethodHandle> cache, java.lang.invoke.SerializedLambda serialized)
LambdaMetafactory.altMetafactory
to spin up a lambda class
and instantiating this class with the captured arguments.
A cache may be provided to ensure that subsequent deserialization of the same lambda expression is cheap, it amounts to a reflective call to the constructor of the previously created class. However, deserialization of the same lambda expression is not guaranteed to use the same class, concurrent deserialization of the same lambda expression may spin up more than one class.
Assumptions:
- No additional marker interfaces are required beyond {java.io,scala.}Serializable
. These are
not stored in SerializedLambda
, so we can't reconstitute them.
- No additional bridge methods are passed to altMetafactory
. Again, these are not stored.
lookup
- The factory for method handles. Must have access to the implementation method, the
functional interface class, and java.io.Serializable
or scala.Serializable
as
required.cache
- A cache used to avoid spinning up a class for each deserialization of a given lambda. May be null
serialized
- The lambda to deserialize. Note that this is typically created by the readResolve
member of the anonymous class created by LambdaMetaFactory
.