RFR: 8282080: Lambda deserialization fails for Object method references on interfaces

Jan Lahoda jlahoda at openjdk.java.net
Mon Apr 25 20:12:34 UTC 2022


On Mon, 25 Apr 2022 18:53:23 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> not sure I get all the context here, why shouldn't we do the same for serialization that we are doing for non serialized classes? Is this because of some specified behavior probably on the serialization spec?

This problem only occurs for serialized method references. Basically, javac will generate a reference to something like `I::hashCode`. At runtime, this will get converted to `Object::hashCode`, and that is then serialized. During deserialization, the deserialization code generated by javac will expect `I::hashCode`, but will get `Object::hashCode` from the serialized data, and the deserialization will fail. All this patch is trying to do is to generated the deserialization code in a way where it expects `Object::hashCode` - which is what is currently part of the serialized data. The only change is that before [JDK-8272564](https://bugs.openjdk.java.net/browse/JDK-8272564), the generated deserialization code expected `Object::hashCode`, while it currently expects `I::hashCode`, and this patch proposes to change that back to `Object::hashCode`.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8054


More information about the compiler-dev mailing list