forked from EsotericSoftware/kryo
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Closure public, moving it to ClosureSerializer.
Closure is moved to ClosureSerializer because it's tightly coupled and this makes the connection more obvious. This also renames `Kryo.isClousre` to `isClosure`, assuming that it was not used until now it's ignored regarding binary compatibility. Fixes EsotericSoftware#299, refs EsotericSoftware#215
- Loading branch information
Showing
3 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,15 +30,18 @@ | |
* <p> | ||
* <code> | ||
* kryo.register(java.lang.invoke.SerializedLambda.class);<br> | ||
* kryo.register(Closure.class, new ClosureSerializer());</code> | ||
* kryo.register(ClosureSerializer.Closure.class, new ClosureSerializer());</code> | ||
* @author Roman Levenstein <[email protected]> */ | ||
public class ClosureSerializer extends Serializer { | ||
|
||
/** Marker class to bind ClosureSerializer to. See also {@link Kryo#isClosure(Class)} and {@link Kryo#getRegistration(Class)} */ | ||
public static class Closure { | ||
} | ||
|
||
private static Method readResolve; | ||
private static Class serializedLambda; | ||
private static Class serializedLambda = java.lang.invoke.SerializedLambda.class; | ||
static { | ||
try { | ||
serializedLambda = Class.forName("java.lang.invoke.SerializedLambda"); | ||
readResolve = serializedLambda.getDeclaredMethod("readResolve"); | ||
readResolve.setAccessible(true); | ||
} catch (Exception e) { | ||
|