On Thu, 21 May 2026 02:29:52 GMT, Dan Smith <[email protected]> wrote:
>> So here the first non-serializable superclass that can execute normal >> construction is `java.lang.Object`. Serialization spec for now says >> `BigInteger` is allocated and `Object`'s no-arg constructor is called, and >> the fields are injected. So yes, here `java.lang.Number` initialization in >> the middle must be skipped and that doesn't work. >> >> It worked with `java.lang.Integer` and other wrapper classes because they >> use their deserialization factory instead of this allocate, call super >> constructor, and fill procedure. > > Okay, sounds like we agree we need to adjust the spec. > > I will work on that change, but the expected rule is what it says here in the > javadoc: the instantiated class may not be a value class, and no field > declared by a Serializable class may be `STRICT_INIT`. Filed bug: [JDK-8385170](https://bugs.openjdk.org/browse/JDK-8385170) ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2350#discussion_r3282431700
