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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user