Skip to content

Instantly share code, notes, and snippets.

@jerrinot
Created December 28, 2016 16:47
Show Gist options
  • Save jerrinot/32786cf80e23b10d77c4ce2d18b65068 to your computer and use it in GitHub Desktop.
Save jerrinot/32786cf80e23b10d77c4ce2d18b65068 to your computer and use it in GitHub Desktop.
package lambdaserialization;
import org.junit.Test;
import java.io.IOException;
import java.io.Serializable;
import java.util.function.Supplier;
public class LambdaSerializationBugTest {
@Test
public void testSerializationBug() throws IOException, ClassNotFoundException {
Supplier<String> s1 = (Supplier & Serializable) new FirstChild()::getFoo;
Supplier<String> s2 = (Supplier & Serializable) new SecondChild()::getFoo;
Utils.serializeAndDeserialize(s2);
}
public static class Parent {
public String getFoo() {
return "foo";
}
}
public static class FirstChild extends Parent implements Serializable {
}
public static class SecondChild extends Parent implements Serializable {
}
}
@jerrinot
Copy link
Author

jerrinot commented Dec 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment