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:
Warren Levy 2000-10-05 23:57:16 +00:00 committed by Warren Levy
parent cc0cbae17e
commit bf3478059d
16 changed files with 194 additions and 204 deletions

View file

@ -1,5 +1,5 @@
/* ObjectInputStream.java -- Class used to read serialized objects
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -37,6 +37,7 @@ import gnu.java.io.ObjectIdentityWrapper;
import gnu.java.lang.reflect.TypeSignature;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
@ -189,7 +190,7 @@ public class ObjectInputStream extends InputStream
{
// DEBUG ("STRING ");
String s = this.realInputStream.readUTF ();
ret_val = processResoultion (s, assignNewHandle (s));
ret_val = processResolution (s, assignNewHandle (s));
break;
}
@ -202,7 +203,7 @@ public class ObjectInputStream extends InputStream
Object array = Array.newInstance (componenetType, length);
int handle = assignNewHandle (array);
readArrayElements (array, componenetType);
ret_val = processResoultion (array, handle);
ret_val = processResolution (array, handle);
break;
}
@ -250,7 +251,7 @@ public class ObjectInputStream extends InputStream
if (read_from_blocks)
setBlockDataMode (false);
ret_val = processResoultion (obj, handle);
ret_val = processResolution (obj, handle);
break;
} // end if (Externalizable.class.isAssignableFrom (clazz))
@ -315,7 +316,7 @@ public class ObjectInputStream extends InputStream
this.currentObject = null;
this.currentObjectStreamClass = null;
ret_val = processResoultion (obj, handle);
ret_val = processResolution (obj, handle);
break;
}
@ -937,11 +938,30 @@ public class ObjectInputStream extends InputStream
}
private Object processResoultion (Object obj, int handle)
private Object processResolution (Object obj, int handle)
throws IOException
{
if (obj instanceof Resolvable)
obj = ((Resolvable)obj).readResolve ();
if (obj instanceof Serializable)
{
Method m = null;
try
{
Class classArgs[] = {};
m = obj.getClass ().getDeclaredMethod ("readResolve", 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 (this.resolveEnabled)
obj = resolveObject (obj);