On Wed, 3 Jun 2026 07:17:47 GMT, Alan Bateman <[email protected]> wrote:
>> Yes, they were initially used on `valueOf` static methods. Turns out such >> uses introduced a performance regression for serialization benchmarks, and >> the annotations are moved onto the constructors instead. > > So is the support for static methods a left-over? I'm wondering if > `getDeserializingValueCons` can be simplified and the > `DeserializeConstructor`'s doc updated. It's just just a question on > unused/untested code. I think this factory is well tested in the value class serialization tests, such as `test/jdk/java/io/Serializable/valueObjects/SerializedObjectCombo.java`. I prefer to keep both static method and constructor support so we have some flexibility; for example, the retained constructor support allowed us to migrate from `valueOf` to constructors seamlessly to fix performance issues, and I think similar situations may still happen in the future. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3351187292
