On Tue, Apr 2, 2013 at 3:50 PM, Mike Duigou <mike.dui...@oracle.com> wrote:

>
> - T I will file a spec change request for the addition of ", a power of 2"
> to the @serialData tag for this existing but previously unstated
> requirement.
>

Hi Mike,

I think changing the serialization spec is a mistake.  There are a bunch of
collection classes that use power-of-two backing arrays, but it's clearly
the intent of the authors that this be an implementation detail.  As often
happens, implementation details get accidentally exposed ("leaked") in a
serial form.  Here we see that the size of the backing array is embedded in
the serial form.  There is an incompatibility between the OpenJDK HashMap
implementation and other implementations that don't use power-of-two
backing arrays (which may not exist) but the right fix is to make the
OpenJDK implementation more resilient to the input serial form.  Treat the
backing array size as merely a hint.  If it's not a power of two, make it
so!  That is, remove the "previously unstated requirement".

Reply via email to