Community
Participate
Working Groups
Created attachment 274988 [details] Standalone class demonstrating bug I recently upgraded from Mars to Photon, and quickly ran into some unexpected problems with the new compiler. Basically, Serializing and then deserializing a lambda declared via the normal arrow syntax works fine, but if the lambda is declared via the method reference then the subsequent deserialization fails. This sounds similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=516620 but will fail when serializing/deserializing everything via eclipse. // simulating a Wicket Model public static class DummyModel<T> implements Serializable { private static final long serialVersionUID = 1L; private T object; public DummyModel(T t) { this.object = t; } public T getObject() { return object; } } // Shows the working and failing methods @SuppressWarnings("unchecked") public void runTest() throws IOException, ClassNotFoundException { final DummyModel<Boolean> booleanModel = new DummyModel<Boolean>(false); // Works with both eclipse and javac Object supp0 = (Serializable & Supplier<Boolean>) () -> booleanModel.getObject(); System.out.println("result 0 - " + deserialize(serialize(supp0)).getClass()); // Works with both javac but not eclipse Object supp1 = (Serializable & Supplier<Boolean>) booleanModel::getObject; System.out.println("result 1 - " + deserialize(serialize(supp1)).getClass()); } // Error Exception in thread "main" java.io.IOException: unexpected exception type ... Caused by: java.lang.reflect.InvocationTargetException .... Caused by: java.lang.IllegalArgumentException: Invalid lambda deserialization at SerializationBug.$deserializeLambda$(SerializationBug.java:1) ... 16 more
This could be a duplicate of https://bugs.eclipse.org/bugs/show_bug.cgi?id=515323
(In reply to Alexander Lehmann from comment #1) > This could be a duplicate of > https://bugs.eclipse.org/bugs/show_bug.cgi?id=515323 related but not necessarily the same. See that the other bug is specifically about a difference between a lambda an an equivalent method reference.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
I don't see the problem with master.