I am messing around with Java serialization of lambdas.
I have two completely separate projects that have a single class in them.
Project 1:
class TestMain {
public static void main(String[] args) {
Runnable r = (Runnable & Serializable) () -> {};
// Serialize r to C:/file.ser;
}
}
Project 2:
class TestMain2 {
public static void main(String[] args) {
// Deserialize C:/file.ser to runnable;
}
}
However, upon attempting to deserialize the runnable, it throws an exception saying it can't find TestMain
...is there any way I can avoid this?