ObjectStreamField (ObjectStreamField): Don't unset 'toset' for final fields.
authorBryce McKinlay <mckinlay@redhat.com>
Fri, 23 Jul 2004 21:46:09 +0000 (21:46 +0000)
committerBryce McKinlay <bryce@gcc.gnu.org>
Fri, 23 Jul 2004 21:46:09 +0000 (22:46 +0100)
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

libjava/ChangeLog
libjava/java/io/ObjectStreamField.java
libjava/testsuite/libjava.lang/Serialization.java [new file with mode: 0644]
libjava/testsuite/libjava.lang/Serialization.out [new file with mode: 0644]

index 502d3e867c230af6e379264f625bf7e944a47961..8cb5ecb0dbbc4676f8d7021ee97d03220308119c 100644 (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.
index 830a349344a00adbc1844efee94b920bb5e9a8d5..ab7c934e48c87804c77852c838ba9c6c70081546 100644 (file)
@@ -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 (file)
index 0000000..8178753
--- /dev/null
@@ -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 (file)
index 0000000..9c4e5d0
--- /dev/null
@@ -0,0 +1,3 @@
+8
+99
+[1, 7, 9.95, -900000000000001, -3.14159, X, 122]