This page is no longer maintained — Please continue to the home page at www.scala-lang.org

SerialVersionUID and closures

1 reply
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

Examining changes in the bytecode, I notice that since r23627 closures
are no longer given a SerialVersionUID: the code which added the
serializable annotation was snipped and took that with it. By itself
that is possibly unimportant, but this change also had the effect of
removing the static initializer since that was the only thing in it.
There are 1771 classes which have a like this:

public static {};
Code:
Stack=2, Locals=0, Args_size=0
0: lconst_0
1: putstatic #11; //Field serialVersionUID:J
4: return

in 2.8.1 and no at all in trunk.

I do not know what consequences if any this has, but it makes my spidey
sense tingle. So:

* did we lose the serialversionUID intentionally?
* anyone know of some interesting impact the presence or absence of a
static initializer might have?

rytz
Joined: 2008-07-01,
User offline. Last seen 45 weeks 5 days ago.
Re: SerialVersionUID and closures


On Mon, Jan 3, 2011 at 04:53, Paul Phillips <paulp@improving.org> wrote:
Examining changes in the bytecode, I notice that since r23627 closures
are no longer given a SerialVersionUID: the code which added the
serializable annotation was snipped and took that with it.  By itself
that is possibly unimportant, but this change also had the effect of
removing the static initializer since that was the only thing in it.
There are 1771 classes which have a <clinit> like this:

public static {};
 Code:
  Stack=2, Locals=0, Args_size=0
  0:   lconst_0
  1:   putstatic       #11; //Field serialVersionUID:J
  4:   return

in 2.8.1 and no <clinit> at all in trunk.

I do not know what consequences if any this has, but it makes my spidey
sense tingle.  So:

 * did we lose the serialversionUID intentionally?

No, that was an oversight. Thanks for pointing it out,I'll have a look at it.
Lukas  
 * anyone know of some interesting impact the presence or absence of a
static initializer might have?

--
Paul Phillips      | Simplicity and elegance are unpopular because
Imperfectionist    | they require hard work and discipline to achieve
Empiricist         | and education to be appreciated.
all hip pupils!    |     -- Dijkstra


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland