[kaffe] java.io.ObjectInputStream: final field cannot be restored

Guilhem Lavaux guilhem.lavaux@free.fr
Wed Mar 24 01:10:03 2004


Ito Kazumitsu wrote:
> Hi,

Hi Ito !

> 
> Interested in Prevayler (http://www.prevayler.org/), which is
> marked untested in our "Compatibility - Application Testing",
> I tried it.
> 
> The result was unsatisfactory.  The simplest demo of Prevayler
> cannot run on kaffe.  After studying the cause of the error,
> I found something buggy in java.io.ObjectInputStream.
> 
> My test program is attaced below.  The test shows that a
> field that is marked "final" cannot be restored by
> java.io.ObjectInputStream#readObject.
> 

This is linked to ObjectStreamField.java:67

toset = !Modifier.isFinal(field.getModifiers());

I guess it was placed there for a good reason but I don't remember which 
one. We have to check in the spec again.

Cheers,
Guilhem.