aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io/ObjectOutputStream.java
diff options
context:
space:
mode:
authorWarren Levy <warrenl@cygnus.com>2000-10-05 23:57:16 +0000
committerWarren Levy <warrenl@gcc.gnu.org>2000-10-05 23:57:16 +0000
commitbf3478059df1a948c6b728754150d25b1d5610b1 (patch)
treeab6da2cb575ebc39dc451d7b89674a8d23e7af54 /libjava/java/io/ObjectOutputStream.java
parentcc0cbae17ebe0b5c9a9152cd867d2ae5a5e943db (diff)
downloadgcc-bf3478059df1a948c6b728754150d25b1d5610b1.zip
gcc-bf3478059df1a948c6b728754150d25b1d5610b1.tar.gz
gcc-bf3478059df1a948c6b728754150d25b1d5610b1.tar.bz2
Makefile.am: Removed java/io/Replaceable.java and java/io/Resolvable.java.
* Makefile.am: Removed java/io/Replaceable.java and java/io/Resolvable.java. * Makefile.in: Rebuilt. * gcj/javaprims.h: Removed Replaceable and Resolvable from java.io namespace. * java/io/ObjectInputStream.java (processResolution): Fixed typo in method name. (processResolution): Handle readResolve method via reflection with removal of Resolvable interface. * java/io/ObjectOutputStream.java (writeObject): Handle writeReplace method via reflection with removal of Replaceable interface. * java/io/Replaceable.java: Removed. * java/io/Resolvable.java: Removed. * java/security/Key.java (serialVersionUID): New field. * java/security/Provider.java (serialVersionUID): New field. * java/security/interfaces/DSAPrivateKey.java (serialVersionUID): New field. * java/security/interfaces/DSAPublicKey.java (serialVersionUID): New field. * java/sql/DataTruncation.java (serialVersionUID): New field. * java/sql/SQLException.java (serialVersionUID): New field. * java/sql/SQLWarning.java (serialVersionUID): New field. * java/util/Date.java (serialVersionUID): New field. (millis): Made transient. (readObject): New method. (writeObject): New method. Serialization mods. Note: The interfaces java.io.Replaceable and java.io.Resolvable were only temporary additions to JDK 1.2 beta versions and were not included in the JDK 1.2 final. The Serialization spec instructs how to deal with their methods (via reflection). From-SVN: r36736
Diffstat (limited to 'libjava/java/io/ObjectOutputStream.java')
-rw-r--r--libjava/java/io/ObjectOutputStream.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java
index 664b882..cd6202e 100644
--- a/libjava/java/io/ObjectOutputStream.java
+++ b/libjava/java/io/ObjectOutputStream.java
@@ -30,6 +30,7 @@ package java.io;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import java.util.Hashtable;
import gnu.java.io.ObjectIdentityWrapper;
@@ -241,13 +242,33 @@ public class ObjectOutputStream extends OutputStream
Object replacedObject = null;
- if ((replacementEnabled || obj instanceof Replaceable)
+ if ((replacementEnabled || obj instanceof Serializable)
&& ! replaceDone)
{
replacedObject = obj;
- if (obj instanceof Replaceable)
- obj = ((Replaceable)obj).writeReplace ();
+ if (obj instanceof Serializable)
+ {
+ Method m = null;
+ try
+ {
+ Class classArgs[] = {};
+ m = obj.getClass ().getDeclaredMethod ("writeReplace",
+ classArgs);
+ // m can't be null by definition since an exception would
+ // have been thrown so a check for null is not needed.
+ obj = m.invoke (obj, new Object[] {});
+ }
+ catch (NoSuchMethodException ignore)
+ {
+ }
+ catch (IllegalAccessException ignore)
+ {
+ }
+ catch (InvocationTargetException ignore)
+ {
+ }
+ }
if (replacementEnabled)
obj = replaceObject (obj);