This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Patch: Serialization mods
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: Serialization mods
- From: Warren Levy <warrenl at cygnus dot com>
- Date: Thu, 5 Oct 2000 16:01:10 -0700 (PDT)
Folks,
Here are some more Serialization mods. The corresponding fixes are also
going into Classpath. For those who are curious, java.io.Replaceable and
java.io.Resolvable were interfaces temporarily introduced in beta versions
of the JDK 1.2 but not included in the final. As such, I've removed them
and made the appropriate changes in Serialization (per the spec) to
account for the possible use of their methods (via reflection). I'll be
checking all this in shortly. Enjoy!
--warrenl
2000-10-05 Warren Levy <warrenl@cygnus.com>
* 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.
Index: Makefile.am
===================================================================
RCS file: /cvs/java/libgcj/libjava/Makefile.am,v
retrieving revision 1.90
diff -u -p -r1.90 Makefile.am
--- Makefile.am 2000/09/14 19:24:08 1.90
+++ Makefile.am 2000/10/05 20:06:47
@@ -813,8 +813,6 @@ java/io/PushbackInputStream.java \
java/io/PushbackReader.java \
java/io/RandomAccessFile.java \
java/io/Reader.java \
-java/io/Replaceable.java \
-java/io/Resolvable.java \
java/io/SequenceInputStream.java \
java/io/Serializable.java \
java/io/SerializablePermission.java \
Index: Makefile.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/Makefile.in,v
retrieving revision 1.97
diff -u -p -r1.97 Makefile.in
--- Makefile.in 2000/09/14 19:24:08 1.97
+++ Makefile.in 2000/10/05 20:06:48
@@ -68,6 +68,7 @@ AR = @AR@
AS = @AS@
CC = @CC@
COMPPATH = @COMPPATH@
+CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DIRLTDL = @DIRLTDL@
@@ -78,8 +79,6 @@ EXEEXT = @EXEEXT@
FORCELIBGCCSPEC = @FORCELIBGCCSPEC@
GCDEPS = @GCDEPS@
GCINCS = @GCINCS@
-GCJ = @GCJ@
-GCJFLAGS = @GCJFLAGS@
GCLIBS = @GCLIBS@
GCOBJS = @GCOBJS@
GCSPEC = @GCSPEC@
@@ -96,11 +95,9 @@ LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PERL = @PERL@
RANLIB = @RANLIB@
-STRIP = @STRIP@
SYSDEP_SOURCES = @SYSDEP_SOURCES@
SYSTEMSPEC = @SYSTEMSPEC@
THREADDEPS = @THREADDEPS@
@@ -118,40 +115,27 @@ here = @here@
libgcj_basedir = @libgcj_basedir@
AUTOMAKE_OPTIONS = foreign no-installinfo
-@TESTSUBDIR_TRUE@SUBDIRS = \
-@TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
-@TESTSUBDIR_FALSE@SUBDIRS = \
-@TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
-@USE_LIBDIR_TRUE@toolexeclibdir = \
-@USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexeclibdir = \
-@USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
-@USE_LIBDIR_FALSE@toolexecdir = \
-@USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
+@TESTSUBDIR_TRUE@SUBDIRS = @TESTSUBDIR_TRUE@$(DIRLTDL) testsuite gcj include
+@TESTSUBDIR_FALSE@SUBDIRS = @TESTSUBDIR_FALSE@$(DIRLTDL) gcj include
+@USE_LIBDIR_TRUE@toolexeclibdir = @USE_LIBDIR_TRUE@$(libdir)$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexeclibdir = @USE_LIBDIR_FALSE@$(toolexecdir)/lib$(MULTISUBDIR)
+@USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias)
toolexeclib_LTLIBRARIES = libgcj.la
toolexeclib_DATA = libgcj.spec
data_DATA = libgcj.zip
-@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = \
-@NEEDS_DATA_START_TRUE@libgcjdata.a
-@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = \
-@NEEDS_DATA_START_TRUE@libgcjdata.c
+@NEEDS_DATA_START_TRUE@toolexeclib_LIBRARIES = @NEEDS_DATA_START_TRUE@libgcjdata.a
+@NEEDS_DATA_START_TRUE@libgcjdata_a_SOURCES = @NEEDS_DATA_START_TRUE@libgcjdata.c
-@NATIVE_TRUE@bin_PROGRAMS = \
-@NATIVE_TRUE@jv-convert gij
+@NATIVE_TRUE@bin_PROGRAMS = @NATIVE_TRUE@jv-convert gij
bin_SCRIPTS = addr2name.awk
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = \
-@CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = \
-@CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
-@CANADIAN_FALSE@ZIP = \
-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
-@CANADIAN_TRUE@GCJH = \
-@CANADIAN_TRUE@gcjh
-@CANADIAN_FALSE@GCJH = \
-@CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_TRUE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_TRUE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
+@CANADIAN_TRUE@@NULL_TARGET_FALSE@ZIP = @CANADIAN_TRUE@@NULL_TARGET_FALSE@zip
+@CANADIAN_FALSE@ZIP = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/zip/zip$(EXEEXT)
+@CANADIAN_TRUE@GCJH = @CANADIAN_TRUE@gcjh
+@CANADIAN_FALSE@GCJH = @CANADIAN_FALSE@$(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh$(EXEEXT)
GCJCOMPILE = $(LIBTOOL) --mode=compile $(GCJ) -fassume-compiled -fclasspath=$(here) -L$(here) $(JC1FLAGS) -c
GCJLINK = $(LIBTOOL) --mode=link $(GCJ) -L$(here) $(JC1FLAGS) $(LDFLAGS) -o $@
@@ -166,10 +150,8 @@ AM_CXXFLAGS = -fno-rtti -fvtable-thunks
-fdollars-in-identifiers \
@LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ $(WARNINGS) -D_GNU_SOURCE
-@USING_GCC_TRUE@AM_CFLAGS = \
-@USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
-@USING_GCC_FALSE@AM_CFLAGS = \
-@USING_GCC_FALSE@@LIBGCJ_CFLAGS@
+@USING_GCC_TRUE@AM_CFLAGS = @USING_GCC_TRUE@@LIBGCJ_CFLAGS@ $(WARNINGS)
+@USING_GCC_FALSE@AM_CFLAGS = @USING_GCC_FALSE@@LIBGCJ_CFLAGS@
JCFLAGS = -g
JC1FLAGS = -g @LIBGCJ_JAVAFLAGS@
@@ -221,8 +203,7 @@ extra_headers = java/lang/Object.h java/
NM = nm
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = \
-@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
+@NATIVE_TRUE@@MAINTAINER_MODE_TRUE@noinst_PROGRAMS = @NATIVE_TRUE@@MAINTAINER_MODE_TRUE@gen-from-JIS
CONVERT_DIR = gnu/gcj/convert
@@ -596,8 +577,6 @@ java/io/PushbackInputStream.java \
java/io/PushbackReader.java \
java/io/RandomAccessFile.java \
java/io/Reader.java \
-java/io/Replaceable.java \
-java/io/Resolvable.java \
java/io/SequenceInputStream.java \
java/io/Serializable.java \
java/io/SerializablePermission.java \
@@ -1015,7 +994,7 @@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libgcjdata_a_LIBADD =
-@NEEDS_DATA_START_TRUE@libgcjdata_a_OBJECTS = libgcjdata.$(OBJEXT)
+@NEEDS_DATA_START_TRUE@libgcjdata_a_OBJECTS = libgcjdata.o
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libgcj_la_OBJECTS = prims.lo posix.lo jni.lo exception.lo resolve.lo \
@@ -1026,7 +1005,7 @@ defineclass.lo interpret.lo name-finder.
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
jv_convert_OBJECTS =
-gij_OBJECTS = gij.$(OBJEXT)
+gij_OBJECTS = gij.o
gen_from_JIS_OBJECTS =
gen_from_JIS_LDFLAGS =
SCRIPTS = $(bin_SCRIPTS)
@@ -1044,13 +1023,14 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(
DATA = $(data_DATA) $(toolexeclib_DATA)
DIST_COMMON = README COPYING ChangeLog Makefile.am Makefile.in NEWS \
-THANKS acinclude.m4 aclocal.m4 configure configure.in \
-libgcj-test.spec.in libgcj.spec.in
+THANKS acconfig.h acinclude.m4 aclocal.m4 configure configure.in \
+include/config.h.in include/stamp-h.in libgcj-test.spec.in \
+libgcj.spec.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = tar
+TAR = gtar
GZIP_ENV = --best
DIST_SUBDIRS = @DIRLTDL@ testsuite gcj include @DIRLTDL@ gcj include
DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
@@ -1282,8 +1262,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_D
.deps/java/io/PipedWriter.P .deps/java/io/PrintStream.P \
.deps/java/io/PrintWriter.P .deps/java/io/PushbackInputStream.P \
.deps/java/io/PushbackReader.P .deps/java/io/RandomAccessFile.P \
-.deps/java/io/Reader.P .deps/java/io/Replaceable.P \
-.deps/java/io/Resolvable.P .deps/java/io/SequenceInputStream.P \
+.deps/java/io/Reader.P .deps/java/io/SequenceInputStream.P \
.deps/java/io/Serializable.P .deps/java/io/SerializablePermission.P \
.deps/java/io/StreamCorruptedException.P \
.deps/java/io/StreamTokenizer.P .deps/java/io/StringBufferInputStream.P \
@@ -1504,7 +1483,7 @@ OBJECTS = $(libgcjdata_a_OBJECTS) $(libg
all: all-redirect
.SUFFIXES:
-.SUFFIXES: .S .c .cc .class .h .java .lo .o .obj .s
+.SUFFIXES: .S .c .cc .class .h .java .lo .o .s
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile
@@ -1519,6 +1498,34 @@ config.status: $(srcdir)/configure $(CON
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
+
+include/config.h: include/stamp-h
+ @if test ! -f $@; then \
+ rm -f include/stamp-h; \
+ $(MAKE) include/stamp-h; \
+ else :; fi
+include/stamp-h: $(srcdir)/include/config.h.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=include/config.h \
+ $(SHELL) ./config.status
+ @echo timestamp > include/stamp-h 2> /dev/null
+$(srcdir)/include/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/include/stamp-h.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/include/stamp-h.in; \
+ $(MAKE) $(srcdir)/include/stamp-h.in; \
+ else :; fi
+$(srcdir)/include/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @echo timestamp > $(srcdir)/include/stamp-h.in 2> /dev/null
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f include/config.h
+
+maintainer-clean-hdr:
libgcj.spec: $(top_builddir)/config.status libgcj.spec.in
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
libgcj-test.spec: $(top_builddir)/config.status libgcj-test.spec.in
@@ -1556,11 +1563,6 @@ uninstall-toolexeclibLIBRARIES:
rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \
done
-# FIXME: We should only use cygpath when building on Windows,
-# and only if it is available.
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
.s.o:
$(COMPILE) -c $<
@@ -1569,7 +1571,6 @@ uninstall-toolexeclibLIBRARIES:
mostlyclean-compile:
-rm -f *.o core *.core
- -rm -f *.$(OBJEXT)
clean-compile:
@@ -1693,8 +1694,6 @@ uninstall-binSCRIPTS:
done
.cc.o:
$(CXXCOMPILE) -c $<
-.cc.obj:
- $(CXXCOMPILE) -c `cygpath -w $<`
.cc.lo:
$(LTCXXCOMPILE) -c $<
@@ -1871,7 +1870,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
- cp -pr $$/$$file $(distdir)/$$file; \
+ cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
@@ -1989,31 +1988,33 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-mostlyclean-am: mostlyclean-toolexeclibLIBRARIES mostlyclean-compile \
- mostlyclean-libtool mostlyclean-toolexeclibLTLIBRARIES \
+mostlyclean-am: mostlyclean-hdr mostlyclean-toolexeclibLIBRARIES \
+ mostlyclean-compile mostlyclean-libtool \
+ mostlyclean-toolexeclibLTLIBRARIES \
mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
mostlyclean-tags mostlyclean-depend mostlyclean-generic
mostlyclean: mostlyclean-recursive
-clean-am: clean-toolexeclibLIBRARIES clean-compile clean-libtool \
- clean-toolexeclibLTLIBRARIES clean-binPROGRAMS \
- clean-noinstPROGRAMS clean-tags clean-depend \
- clean-generic mostlyclean-am clean-local
+clean-am: clean-hdr clean-toolexeclibLIBRARIES clean-compile \
+ clean-libtool clean-toolexeclibLTLIBRARIES \
+ clean-binPROGRAMS clean-noinstPROGRAMS clean-tags \
+ clean-depend clean-generic mostlyclean-am clean-local
clean: clean-recursive
-distclean-am: distclean-toolexeclibLIBRARIES distclean-compile \
- distclean-libtool distclean-toolexeclibLTLIBRARIES \
- distclean-binPROGRAMS distclean-noinstPROGRAMS \
- distclean-tags distclean-depend distclean-generic \
- clean-am
+distclean-am: distclean-hdr distclean-toolexeclibLIBRARIES \
+ distclean-compile distclean-libtool \
+ distclean-toolexeclibLTLIBRARIES distclean-binPROGRAMS \
+ distclean-noinstPROGRAMS distclean-tags \
+ distclean-depend distclean-generic clean-am
-rm -f libtool
distclean: distclean-recursive
-rm -f config.status
-maintainer-clean-am: maintainer-clean-toolexeclibLIBRARIES \
+maintainer-clean-am: maintainer-clean-hdr \
+ maintainer-clean-toolexeclibLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-toolexeclibLTLIBRARIES \
maintainer-clean-binPROGRAMS \
@@ -2026,7 +2027,8 @@ maintainer-clean-am: maintainer-clean-t
maintainer-clean: maintainer-clean-recursive
-rm -f config.status
-.PHONY: mostlyclean-toolexeclibLIBRARIES distclean-toolexeclibLIBRARIES \
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+mostlyclean-toolexeclibLIBRARIES distclean-toolexeclibLIBRARIES \
clean-toolexeclibLIBRARIES maintainer-clean-toolexeclibLIBRARIES \
uninstall-toolexeclibLIBRARIES install-toolexeclibLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
Index: gcj/javaprims.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/javaprims.h,v
retrieving revision 1.12
diff -u -p -r1.12 javaprims.h
--- javaprims.h 2000/08/19 18:19:41 1.12
+++ javaprims.h 2000/10/05 20:06:50
@@ -103,8 +103,6 @@ extern "Java"
class PushbackReader;
class RandomAccessFile;
class Reader;
- class Replaceable;
- class Resolvable;
class SequenceInputStream;
class Serializable;
class SerializablePermission;
Index: java/io/ObjectInputStream.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/io/ObjectInputStream.java,v
retrieving revision 1.2
diff -u -p -r1.2 ObjectInputStream.java
--- ObjectInputStream.java 2000/08/04 00:42:20 1.2
+++ ObjectInputStream.java 2000/10/05 20:06:51
@@ -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 I
{
// 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 I
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 I
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 I
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 I
}
- 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);
Index: java/io/ObjectOutputStream.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/io/ObjectOutputStream.java,v
retrieving revision 1.6
diff -u -p -r1.6 ObjectOutputStream.java
--- ObjectOutputStream.java 2000/09/08 19:37:08 1.6
+++ ObjectOutputStream.java 2000/10/05 20:06:51
@@ -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
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);
cvs server: java/io/Replaceable.java was removed, no comparison available
cvs server: java/io/Resolvable.java was removed, no comparison available
Index: java/security/Key.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/security/Key.java,v
retrieving revision 1.3
diff -u -p -r1.3 Key.java
--- Key.java 2000/07/27 23:57:07 1.3
+++ Key.java 2000/10/05 20:06:52
@@ -20,8 +20,7 @@ import java.io.Serializable;
public interface Key extends Serializable
{
- // FIXME: need to set this at some point when serialization is implemented.
- // public static final long serialVersionUID = 0L;
+ public static final long serialVersionUID = 6603384152749567654L;
public String getAlgorithm();
public String getFormat();
Index: java/security/Provider.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/security/Provider.java,v
retrieving revision 1.2
diff -u -p -r1.2 Provider.java
--- Provider.java 2000/06/27 05:10:03 1.2
+++ Provider.java 2000/10/05 20:06:52
@@ -1,5 +1,5 @@
/* Provider.java -- Security provider information
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -67,6 +67,8 @@ private String name;
* This is the version number of the provider
*/
private double version;
+
+private static final long serialVersionUID = -4298000515446427739L;
/*************************************************************************/
Index: java/security/interfaces/DSAPrivateKey.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/security/interfaces/DSAPrivateKey.java,v
retrieving revision 1.3
diff -u -p -r1.3 DSAPrivateKey.java
--- DSAPrivateKey.java 2000/07/27 23:57:07 1.3
+++ DSAPrivateKey.java 2000/10/05 20:06:52
@@ -21,8 +21,7 @@ import java.math.BigInteger;
public interface DSAPrivateKey extends DSAKey, PrivateKey
{
- // FIXME: need to set this at some point when serialization is implemented.
- // public static final long serialVersionUID = 0L;
+ public static final long serialVersionUID = 7776497482533790279L;
public BigInteger getX();
}
Index: java/security/interfaces/DSAPublicKey.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/security/interfaces/DSAPublicKey.java,v
retrieving revision 1.3
diff -u -p -r1.3 DSAPublicKey.java
--- DSAPublicKey.java 2000/07/27 23:57:07 1.3
+++ DSAPublicKey.java 2000/10/05 20:06:52
@@ -21,8 +21,7 @@ import java.math.BigInteger;
public interface DSAPublicKey extends DSAKey, PublicKey
{
- // FIXME: need to set this at some point when serialization is implemented.
- // public static final long serialVersionUID = 0L;
+ public static final long serialVersionUID = 1234526332779022332L;
public BigInteger getY();
}
Index: java/sql/DataTruncation.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/sql/DataTruncation.java,v
retrieving revision 1.1
diff -u -p -r1.1 DataTruncation.java
--- DataTruncation.java 2000/04/11 09:21:53 1.1
+++ DataTruncation.java 2000/10/05 20:06:52
@@ -1,5 +1,5 @@
/* DataTruncation.java -- Warning when data has been truncated.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -71,6 +71,8 @@ private boolean read;
* @serialized
*/
private int transferSize;
+
+private static final long serialVersionUID = 6464298989504059473L;
/*************************************************************************/
Index: java/sql/SQLException.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/sql/SQLException.java,v
retrieving revision 1.1
diff -u -p -r1.1 SQLException.java
--- SQLException.java 2000/04/11 09:21:53 1.1
+++ SQLException.java 2000/10/05 20:06:52
@@ -1,5 +1,5 @@
/* SQLException.java -- General SQL exception
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,6 +58,8 @@ private String SQLState;
* @serialized
*/
private int vendorCode;
+
+private static final long serialVersionUID = 2135244094396331484L;
/*************************************************************************/
Index: java/sql/SQLWarning.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/sql/SQLWarning.java,v
retrieving revision 1.1
diff -u -p -r1.1 SQLWarning.java
--- SQLWarning.java 2000/04/11 09:21:53 1.1
+++ SQLWarning.java 2000/10/05 20:06:52
@@ -1,5 +1,5 @@
/* SQLWarning.java -- Database access warnings.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -131,6 +131,8 @@ setNextWarning(SQLWarning e)
{
super.setNextException(e);
}
+
+private static final long serialVersionUID = 3917336774604784856L;
} // class SQLWarning
Index: java/util/Date.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/Date.java,v
retrieving revision 1.4
diff -u -p -r1.4 Date.java
--- Date.java 2000/03/07 19:55:27 1.4
+++ Date.java 2000/10/05 20:06:53
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -18,13 +18,13 @@ import java.text.*;
* "The Java Language Specification", ISBN 0-201-63451-1,
* and O'Reilly's "Java in a Nutshell".
* Status: Need to re-write toString().
- * Missing: ToGMTString and toLocaleString.
- * Serialization spec: Specifies readObject/writeObject.
+ * Missing: ToGMTString.
*/
-
public class Date implements java.io.Serializable, Cloneable
{
- private long millis;
+ private static final long serialVersionUID = 7523967970034938905L;
+
+ transient private long millis;
public Date() { millis = System.currentTimeMillis(); }
@@ -479,5 +479,28 @@ public class Date implements java.io.Ser
GregorianCalendar cal = new GregorianCalendar (TimeZone.zoneGMT);
cal.set(year+1900, month, date, hours, minutes, seconds);
return cal.getTimeInMillis();
+ }
+
+ /**
+ * Reads an Object from the stream.
+ */
+ private void readObject (java.io.ObjectInputStream input)
+ throws java.io.IOException, ClassNotFoundException
+ {
+ input.defaultReadObject ();
+ millis = input.readLong ();
+ }
+
+ /**
+ * Writes an Object to the stream.
+ * @serialdata A long value representing the offset from the epoch
+ * in milliseconds. This is the same value that is returned by the
+ * method getTime().
+ */
+ private void writeObject (java.io.ObjectOutputStream output)
+ throws java.io.IOException
+ {
+ output.defaultWriteObject ();
+ output.writeLong (millis);
}
}