ObjectStreamField (ObjectStreamField): Don't unset 'toset' for final fields.

2004-07-23  Bryce McKinlay  <mckinlay@redhat.com>

	* java/io/ObjectStreamField (ObjectStreamField): Don't unset 'toset'
	for final fields.
	* testsuite/libjava.lang/Serialization.java: New test.
	* testsuite/libjava.lang/Serialization.out: New.

From-SVN: r85096
This commit is contained in:
Bryce McKinlay 2004-07-23 21:46:09 +00:00 committed by Bryce McKinlay
parent 30678c3e48
commit ae066484df
4 changed files with 43 additions and 2 deletions

View File

@ -1,4 +1,11 @@
2004-07-23 Mark Wielaard <mark@klomp.org>
2004-07-23 Bryce McKinlay <mckinlay@redhat.com>
* java/io/ObjectStreamField (ObjectStreamField): Don't unset 'toset' for final
fields.
* testsuite/libjava.lang/Serialization.java: New test.
* testsuite/libjava.lang/Serialization.out: New.
2004-07-23 Bryce McKinlay <mckinlay@redhat.com>
* gnu/java/net/DefaultContentHandlerFactory.java: Check in real file
missed in last commit.

View File

@ -65,7 +65,6 @@ public class ObjectStreamField implements Comparable
{
this (field.getName(), field.getType());
this.field = field;
toset = !Modifier.isFinal(field.getModifiers());
}
/**

View File

@ -0,0 +1,32 @@
import java.io.*;
import java.util.*;
public class Serialization
{
public static void main(String[] args)
throws IOException, ClassNotFoundException
{
File f = new File("test.ser");
ObjectOutputStream objStream =
new ObjectOutputStream(new FileOutputStream(f));
objStream.writeInt(8);
objStream.writeObject(new Integer(99));
List l = new LinkedList();
l.add(new Integer(1));
l.add(new Short((short) 7));
l.add(new Float(9.95));
l.add(new Long(-900000000000001l));
l.add(new Double(-3.14159));
l.add(new Character('X'));
l.add(new Byte((byte) 'z'));
objStream.writeObject(l);
objStream.close();
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
System.out.println (ois.readInt());
System.out.println (ois.readObject());
System.out.println (ois.readObject());
ois.close();
f.delete();
}
}

View File

@ -0,0 +1,3 @@
8
99
[1, 7, 9.95, -900000000000001, -3.14159, X, 122]