Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8202922

Method reference identity is broken by serialization

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 11
    • 8u172, 10, 11
    • core-libs
    • None

    Backports

      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.

        Attachments

          Issue Links

            Activity

              People

                psandoz Paul Sandoz
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: