RFR 8231314: java.time serialization warning cleanup

Chris Hegarty chris.hegarty at oracle.com
Sat Sep 21 10:31:11 UTC 2019


> On 20 Sep 2019, at 19:51, Roger Riggs <Roger.Riggs at oracle.com> wrote:
> Please review code cleanup that will remove the need to suppress soon to be introduced
> warnings [1] about static typing of serialization related fields.
> A few of the implementation Ser classes that serialize java.time types are affected.
> Webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-warn-serializable-8231314/

I think the change is fine, just a few comments..

- AbstractChronology is not necessarily is not always Serializable, but writeReplace expects that it is. Since this is a package-private method, then I assume that it will only ever be called by Serializable subtypes or the serialization framework itself.

- time/chrono/Ser.java : it’s kinda awkward to have to cast the return of readExternal, especially since the set of types is locked down, but without these readExternal methods returning xxxImpl types there is little choice.


More information about the core-libs-dev mailing list