diff options
author | warrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-05 23:57:16 +0000 |
---|---|---|
committer | warrenl <warrenl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-05 23:57:16 +0000 |
commit | f7ce7e1e7ea220277a849d860fa470f665b84a9c (patch) | |
tree | ab6da2cb575ebc39dc451d7b89674a8d23e7af54 /libjava/java/io/ObjectOutputStream.java | |
parent | 0b43d1b24866cb86b5440744dc54b82ebf7fb125 (diff) |
* 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).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36736 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/io/ObjectOutputStream.java')
-rw-r--r-- | libjava/java/io/ObjectOutputStream.java | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java index 664b882e229..cd6202ef877 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); |