FasterXML / jackson-annotations

Core annotations (annotations that only depend on jackson-core) for Jackson data processor
https://github.com/FasterXML/jackson
Apache License 2.0
1.03k stars 331 forks source link

Merge forward JDK-6-compatible `equals()` and `hashcode()` implementations into `JsonTypeInfo.Value` of `master` #230

Closed JooHyukKim closed 1 year ago

JooHyukKim commented 1 year ago

Motivation

This PR is for forwards-compatiblity with 3.0. As discussed in https://github.com/FasterXML/jackson-annotations/pull/229#discussion_r1197970359, same as title. I would like to see the implemenations to be "exactly" the same.

Background

Originated from backporting JsonTypeInfo.Value of Jackson 3.0 into Jackson 2.16 in https://github.com/FasterXML/jackson-annotations/pull/229. The equals() and hashcode() implementations of JsonTypeInfo.Value in Jackson 3.0 (master branch) could not be directly copied because of its usage of JDK7 util methods Objects.equals() and Objects.hashcode() util methods, so ended up using the internal Objects.hashcode() implementation.

cowtowncoder commented 1 year ago

Thanks but 3.0 will be based on at least Java 8 and probably later 17. No point in holding back those implementations since code should not need to be changed a lot.