From: Bryce McKinlay Date: Fri, 23 Jul 2004 21:46:09 +0000 (+0000) Subject: ObjectStreamField (ObjectStreamField): Don't unset 'toset' for final fields. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae066484dfc4edafddbcf5089720d8ceef28c232;p=gcc.git ObjectStreamField (ObjectStreamField): Don't unset 'toset' for final fields. 2004-07-23 Bryce McKinlay * 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 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 502d3e867c2..8cb5ecb0dbb 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,4 +1,11 @@ -2004-07-23 Mark Wielaard +2004-07-23 Bryce McKinlay + + * 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 * gnu/java/net/DefaultContentHandlerFactory.java: Check in real file missed in last commit. diff --git a/libjava/java/io/ObjectStreamField.java b/libjava/java/io/ObjectStreamField.java index 830a349344a..ab7c934e48c 100644 --- a/libjava/java/io/ObjectStreamField.java +++ b/libjava/java/io/ObjectStreamField.java @@ -65,7 +65,6 @@ public class ObjectStreamField implements Comparable { this (field.getName(), field.getType()); this.field = field; - toset = !Modifier.isFinal(field.getModifiers()); } /** diff --git a/libjava/testsuite/libjava.lang/Serialization.java b/libjava/testsuite/libjava.lang/Serialization.java new file mode 100644 index 00000000000..81787533126 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Serialization.java @@ -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(); + } +} diff --git a/libjava/testsuite/libjava.lang/Serialization.out b/libjava/testsuite/libjava.lang/Serialization.out new file mode 100644 index 00000000000..9c4e5d06c46 --- /dev/null +++ b/libjava/testsuite/libjava.lang/Serialization.out @@ -0,0 +1,3 @@ +8 +99 +[1, 7, 9.95, -900000000000001, -3.14159, X, 122]