Skip to content

Instant prior to Instant.EPOCH is not equal after serialization/deserialization #120

Description

@naiello

It seems that certain java.time.Instant instances prior to Instant.EPOCH are not equal after being serialized, then deserialized.

As you can see from this gist, serializing then deserializing an Instant one millisecond prior to the epoch (1969-12-31T23:59:59.999Z) results in an Instant 1.998 seconds earlier: 1969-12-31T23:59:58.001Z

As mentioned above, this affects only Instants with a nonzero nanos field. Instant.ofEpochMilli(-1001) is not equal after deserialization, while Instant.ofEpochMilli(1000) is equal.

Using OpenJDK8 1.8.0_202 and Jackson 2.9.8.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions