8026344: j.u.c.a *Adder and *Accumulator extend a package private class that is Serializable
Doug Lea
dl at cs.oswego.edu
Wed Oct 23 17:03:33 UTC 2013
On 10/23/2013 11:17 AM, Chris Hegarty wrote:
> Looks fine to me.
>
> Should all SerializationProxy classes have the same serialVersionUID ( =
> 7249069246863182397L ) ?
>
Not only that, it is the same as that for the main classes themselves.
It should simplify ability to check any errors in cases anyone ever
tries to change any of them without changing all of them.
-Doug
> -Chris.
>
> On 23/10/2013 15:06, Alan Bateman wrote:
>>
>> j.u.c.atomic.{Double,Long}.{Accumulator,Adder} extend a package-private
>> class Striped64 that does striping on 64-bit values. This super type is
>> Serializable by way of extending Number. Striped64 doesn't contribute
>> any serial fields but its name does leak into the serial stream because
>> there is a descriptor for the super type when it is also serializable.
>> Those that write conformance tests have noticed this.
>>
>> In practical terms this is a bit of a non-issue but the reference to
>> Striped64 can be removed from the serial stream by changing these four
>> to use a serialization proxy. Doug has gone ahead and changed the
>> classes in jsr166 CVS and we need to bring these changes into jdk8/tl by
>> the ZBB date.
>>
>> The webrev with the proposed changes is here:
>>
>> http://cr.openjdk.java.net/~alanb/8026344/webrev/
>>
>> A minor difference with what is currently in the CVS is that I've added
>> a link in the writeReplace javadoc to the proxy class. I've also added a
>> simple test as I didn't find any tests in the jdk repository that
>> exercise serialization of these classes.
>>
>> -Alan.
>>
>
More information about the core-libs-dev
mailing list