Details
-
Bug
-
Resolution: Fixed
-
P3
-
8u172, 10, 11
-
None
-
b20
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8206734 | 12 | Paul Sandoz | P3 | Resolved | Fixed | team |
JDK-8206509 | 11.0.1 | Paul Sandoz | P3 | Resolved | Fixed | b01 |
Description
Initially reported here:
https://www.reddit.com/r/java/comments/8i9nd6/a_surprising_feature_of_method_references/
See the minimal test here:
http://cr.openjdk.java.net/~shade/8202922/webrev.01/
It fails with:
$ CONF=linux-x86_64-normal-server-fastdebug make images run-test TEST=jdk/java/lang/invoke/lambda/LambdaSerializationIdentity.java
...
STDERR:
java.lang.IllegalStateException: Identity is broken after serialization:
input1 = LambdaSerializationIdentity$$Lambda$45/0x00000001000ca440@391d7b1e
input2 = LambdaSerializationIdentity$$Lambda$46/0x00000001000c9840@76da0005
output1 = LambdaSerializationIdentity$$Lambda$47/0x00000001000c9040@1513b46e
output2 = LambdaSerializationIdentity$$Lambda$47/0x00000001000c9040@1513b46e
This comes from two static method references, which are not equal to each other before serialization, but are equal after the serialization. So, two distinct Objects instantiated with method references evaluation come into serialization, and two identical Objects come out.
https://www.reddit.com/r/java/comments/8i9nd6/a_surprising_feature_of_method_references/
See the minimal test here:
http://cr.openjdk.java.net/~shade/8202922/webrev.01/
It fails with:
$ CONF=linux-x86_64-normal-server-fastdebug make images run-test TEST=jdk/java/lang/invoke/lambda/LambdaSerializationIdentity.java
...
STDERR:
java.lang.IllegalStateException: Identity is broken after serialization:
input1 = LambdaSerializationIdentity$$Lambda$45/0x00000001000ca440@391d7b1e
input2 = LambdaSerializationIdentity$$Lambda$46/0x00000001000c9840@76da0005
output1 = LambdaSerializationIdentity$$Lambda$47/0x00000001000c9040@1513b46e
output2 = LambdaSerializationIdentity$$Lambda$47/0x00000001000c9040@1513b46e
This comes from two static method references, which are not equal to each other before serialization, but are equal after the serialization. So, two distinct Objects instantiated with method references evaluation come into serialization, and two identical Objects come out.
Attachments
Issue Links
- backported by
-
JDK-8206509 Method reference identity is broken by serialization
- Resolved
-
JDK-8206734 Method reference identity is broken by serialization
- Resolved
- csr for
-
JDK-8205060 Method reference identity is broken by serialization
- Closed
- relates to
-
JDK-8204255 15.27.4: Clarify the identity of the result of evaluating a lambda expression
- Resolved