2
0
mirror of git://gcc.gnu.org/git/gcc.git synced 2024-12-21 03:39:29 +08:00

PropertyChangeEvent.java (serialVersionUID): Added.

* java/beans/PropertyChangeEvent.java (serialVersionUID): Added.
	* java/beans/PropertyVetoException.java (serialVersionUID): Added.
	* java/io/File.java (writeObject): Added.
	(readObject): Added.
	(serialVersionUID): Added.
	* java/io/ObjectOutputStream.java (writeObject): Initialized
	fieldsAlreadyWritten before recursion rather than after.
	* java/io/ObjectStreamClass.java (serialVersionUID): Added.
	* java/io/OptionalDataException.java (serialVersionUID): Added.
	(OptionalDataException): Made package private.
	* java/io/SyncFailedException.java (SyncFailedException): Removed
	default constructor to match spec.
	* java/lang/Boolean.java (serialVersionUID): Added.
	* java/lang/Byte.java (serialVersionUID): Added.
	* java/lang/Character.java (serialVersionUID): Added.
	* java/lang/Double.java (serialVersionUID): Added.
	* java/lang/Float.java (serialVersionUID): Added.
	* java/lang/Integer.java (serialVersionUID): Added.
	* java/lang/Long.java (serialVersionUID): Added.
	* java/lang/Number.java (serialVersionUID): Added.
	* java/lang/Short.java (serialVersionUID): Added.
	* java/lang/String.java (serialVersionUID): Added.
	* java/lang/ThreadDeath.java (ThreadDeath): Removed constructor
	to match spec.
	* java/lang/reflect/InvocationTargetException.java
	(serialVersionUID): Added.
	* java/net/URL.java (handler): Made transient.
	(hashCode): Added field for serialization, per spec. and use
	cached value if available.
	(serialVersionUID): Added.
	(URL): Initialize hashCode.
	(set): Adjust hashCode.
	(readObject): New Method to initialize the protocol handler when
	deserializing.
	(writeObject): New method.
	* java/text/BreakIterator.java: Removed 'implements Serializable'.
	* java/text/Collator.java: Removed 'implements Serializable'.
	* java/util/GregorianCalendar.java (serialVersionUID): Added.
	* java/util/Properties.java (serialVersionUID): Added.
	* java/util/Random.java (serialVersionUID): Added.
	(seed): Made private.
	(nextNextGaussian): Made private.
	(haveNextNextGaussian): Made private.
	* java/util/Stack.java (serialVersionUID): Added.
	* java/util/TimeZone.java (serialVersionUID): Added.
	* java/util/Vector.java (serialVersionUID): Added.

Serialization mods.

From-SVN: r36272
This commit is contained in:
Warren Levy 2000-09-08 19:37:09 +00:00 committed by Warren Levy
parent 759e81878c
commit bc6ccd3316
29 changed files with 162 additions and 34 deletions

View File

@ -1,3 +1,52 @@
2000-09-08 Warren Levy <warrenl@cygnus.com>
* java/beans/PropertyChangeEvent.java (serialVersionUID): Added.
* java/beans/PropertyVetoException.java (serialVersionUID): Added.
* java/io/File.java (writeObject): Added.
(readObject): Added.
(serialVersionUID): Added.
* java/io/ObjectOutputStream.java (writeObject): Initialized
fieldsAlreadyWritten before recursion rather than after.
* java/io/ObjectStreamClass.java (serialVersionUID): Added.
* java/io/OptionalDataException.java (serialVersionUID): Added.
(OptionalDataException): Made package private.
* java/io/SyncFailedException.java (SyncFailedException): Removed
default constructor to match spec.
* java/lang/Boolean.java (serialVersionUID): Added.
* java/lang/Byte.java (serialVersionUID): Added.
* java/lang/Character.java (serialVersionUID): Added.
* java/lang/Double.java (serialVersionUID): Added.
* java/lang/Float.java (serialVersionUID): Added.
* java/lang/Integer.java (serialVersionUID): Added.
* java/lang/Long.java (serialVersionUID): Added.
* java/lang/Number.java (serialVersionUID): Added.
* java/lang/Short.java (serialVersionUID): Added.
* java/lang/String.java (serialVersionUID): Added.
* java/lang/ThreadDeath.java (ThreadDeath): Removed constructor
to match spec.
* java/lang/reflect/InvocationTargetException.java
(serialVersionUID): Added.
* java/net/URL.java (handler): Made transient.
(hashCode): Added field for serialization, per spec. and use
cached value if available.
(serialVersionUID): Added.
(URL): Initialize hashCode.
(set): Adjust hashCode.
(readObject): New Method to initialize the protocol handler when
deserializing.
(writeObject): New method.
* java/text/BreakIterator.java: Removed 'implements Serializable'.
* java/text/Collator.java: Removed 'implements Serializable'.
* java/util/GregorianCalendar.java (serialVersionUID): Added.
* java/util/Properties.java (serialVersionUID): Added.
* java/util/Random.java (serialVersionUID): Added.
(seed): Made private.
(nextNextGaussian): Made private.
(haveNextNextGaussian): Made private.
* java/util/Stack.java (serialVersionUID): Added.
* java/util/TimeZone.java (serialVersionUID): Added.
* java/util/Vector.java (serialVersionUID): Added.
2000-09-07 Bryce McKinlay <bryce@albatross.co.nz>
* Makefile.am (Thread.h): Don't be friends with native threads

View File

@ -54,6 +54,8 @@ public class PropertyChangeEvent extends java.util.EventObject {
Object newValue;
Object propagationId;
private static final long serialVersionUID = 7042693688939648123L;
/** Create a new PropertyChangeEvent. Remember that if
** you received a PropertyChangeEvent and are sending
** a new one, you should also set the propagation ID

View File

@ -39,6 +39,8 @@ package java.beans;
public class PropertyVetoException extends Exception {
PropertyChangeEvent evt;
private static final long serialVersionUID = 129596057694162164L;
/** Instantiate this exception with the given message and property change.
** @param msg the reason for the veto.
** @param changeEvent the PropertyChangeEvent that was thrown.

View File

@ -388,6 +388,24 @@ public class File implements Serializable
FileDeleter.add (this);
}
private void writeObject (ObjectOutputStream oos) throws IOException
{
oos.defaultWriteObject ();
oos.writeChar (separatorChar);
}
private void readObject (ObjectInputStream ois)
throws ClassNotFoundException, IOException
{
ois.defaultReadObject ();
// If the file was from an OS with a different dir separator,
// fixup the path to use the separator on this OS.
char oldSeparatorChar = ois.readChar ();
if (oldSeparatorChar != separatorChar)
path = path.replace (oldSeparatorChar, separatorChar);
}
// QUERY arguments to access function.
private final static int READ = 0;
private final static int WRITE = 1;
@ -404,4 +422,6 @@ public class File implements Serializable
private final native long attr (String p, int query);
private final native boolean access (String p, int query);
private final native boolean stat (String p, int query);
private static final long serialVersionUID = 301077366599181567L;
}

View File

@ -313,12 +313,12 @@ public class ObjectOutputStream extends OutputStream
{
currentObjectStreamClass = hierarchy[i];
fieldsAlreadyWritten = false;
has_write = currentObjectStreamClass.hasWriteMethod ();
writeFields (obj, currentObjectStreamClass.fields,
has_write);
fieldsAlreadyWritten = false;
if (has_write)
{
drain ();

View File

@ -635,6 +635,10 @@ public class ObjectStreamClass implements Serializable
// these are accessed by ObjectIn/OutputStream
int primFieldSize = -1; // -1 if not yet calculated
int objectFieldCount;
// This is probably not necessary because this class is special cased already
// but it will avoid showing up as a discrepancy when comparing SUIDs.
private static final long serialVersionUID = -6120832682080437368L;
}

View File

@ -23,12 +23,16 @@ public class OptionalDataException extends ObjectStreamException
public boolean eof;
public int length;
public OptionalDataException()
// FIXME: This can probably go away once the right signatures of
// these package private constructors is determined.
private static final long serialVersionUID = -8011121865681257820L;
OptionalDataException()
{
super();
}
public OptionalDataException(String msg)
OptionalDataException(String msg)
{
super(msg);
}

View File

@ -22,11 +22,6 @@ package java.io;
public class SyncFailedException extends IOException
{
public SyncFailedException ()
{
super ();
}
public SyncFailedException (String s)
{
super (s);

View File

@ -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.
@ -32,6 +32,8 @@ public final class Boolean extends Object implements Serializable
/* The boolean value of the instance. */
private boolean value;
private static final long serialVersionUID = -3665804199014368530L;
public Boolean(boolean boolVal)
{
value = boolVal;

View File

@ -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.
@ -29,6 +29,8 @@ public final class Byte extends Number implements Comparable
// by javac, and is handled specially by gcc.
public static final Class TYPE = byte.class;
private static final long serialVersionUID = -7183698231559129828L;
public Byte(byte value)
{
this.value = value;

View File

@ -1,6 +1,6 @@
// Character.java - Character class.
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -83,6 +83,7 @@ public final class Character implements Serializable, Comparable
public static final byte PRIVATE_USE = 18;
public static final byte SURROGATE = 19;
private static final long serialVersionUID = 3786198910865385080L;
public Character (char ch)
{

View File

@ -32,6 +32,8 @@ public final class Double extends Number
private double value;
private static final long serialVersionUID = -9172774392245257468L;
public native static double parseDouble (String s)
throws NumberFormatException;

View File

@ -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.
@ -32,6 +32,8 @@ public final class Float extends Number
private float value;
private static final long serialVersionUID = -2671257302660747028L;
public Float (float value)
{
this.value = value;

View File

@ -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.
@ -30,6 +30,8 @@ public final class Integer extends Number implements Comparable
/* The int value of the instance. */
private int value;
private static final long serialVersionUID = 1360826667806852920L;
public Integer(int val)
{
value = val;

View File

@ -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.
@ -30,6 +30,8 @@ public final class Long extends Number implements Comparable
/* The long value of the instance. */
private long value;
private static final long serialVersionUID = 4290774380558885855L;
public Long(long val)
{
value = val;

View File

@ -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.
@ -36,4 +36,6 @@ public abstract class Number implements Serializable
{
return (short) intValue();
}
private static final long serialVersionUID = -8742448824652078965L;
}

View File

@ -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.
@ -29,6 +29,8 @@ public final class Short extends Number implements Comparable
// by javac, and is handled specially by gcc.
public static final Class TYPE = short.class;
private static final long serialVersionUID = 7515723908773894738L;
public Short(short value)
{
this.value = value;

View File

@ -26,6 +26,10 @@ public final class String implements Serializable, Comparable
private int boffset; // Note this is a byte offset - don't use in Java code!
private int count;
// This is probably not necessary because this class is special cased already
// but it will avoid showing up as a discrepancy when comparing SUIDs.
private static final long serialVersionUID = -6849794470754667710L;
public String ()
{
init();

View File

@ -1,6 +1,6 @@
// ThreadDeath.java - Special exception registering Thread death.
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -27,9 +27,4 @@ public class ThreadDeath extends Error
{
super ();
}
public ThreadDeath (String message)
{
super (message);
}
}

View File

@ -1,6 +1,6 @@
// InvocationTargetException.java - Wrapper exception for reflection.
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -70,4 +70,6 @@ public class InvocationTargetException extends Exception
// The wrapped exception. The name is specified by the
// serialization spec.
private Throwable target;
private static final long serialVersionUID = 4085088731926701167L;
}

View File

@ -1,6 +1,6 @@
// URL.java - A Uniform Resource Locator.
/* Copyright (C) 1999 Free Software Foundation
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -32,10 +32,13 @@ public final class URL implements Serializable
private int port = -1; // Initialize for constructor using context.
private String file;
private String ref;
private URLStreamHandler handler;
private int hashCode = 0;
transient private URLStreamHandler handler;
private static Hashtable handlers = new Hashtable();
private static URLStreamHandlerFactory factory;
private static final long serialVersionUID = -7627629688361524110L;
public URL(String protocol, String host, int port, String file)
throws MalformedURLException
{
@ -90,6 +93,7 @@ public final class URL implements Serializable
this.file = file.substring(0, hashAt);
this.ref = file.substring(hashAt + 1);
}
hashCode = hashCode(); // Used for serialization.
}
public URL(String spec) throws MalformedURLException
@ -181,6 +185,8 @@ public final class URL implements Serializable
hashAt < 0 ? spec.length() : hashAt);
if (hashAt >= 0)
ref = spec.substring(hashAt + 1);
hashCode = hashCode(); // Used for serialization.
}
public boolean equals(Object obj)
@ -249,7 +255,10 @@ public final class URL implements Serializable
// (which was reduced to "" with a hashcode of zero). A "" host also
// causes the port number and the two hashcodes to be summed.
return (protocol.hashCode() + ((host == null) ? 0 : host.hashCode()) +
if (hashCode != 0)
return hashCode; // Use cached value if available.
else
return (protocol.hashCode() + ((host == null) ? 0 : host.hashCode()) +
port + file.hashCode());
}
@ -290,6 +299,7 @@ public final class URL implements Serializable
this.host = host;
this.file = file;
this.ref = ref;
hashCode = hashCode(); // Used for serialization.
}
public static synchronized void
@ -384,4 +394,18 @@ public final class URL implements Serializable
return handler;
}
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException
{
ois.defaultReadObject();
this.handler = setURLStreamHandler(protocol);
if (this.handler == null)
throw new IOException("Handler for protocol " + protocol + " not found");
}
private void writeObject(ObjectOutputStream oos) throws IOException
{
oos.defaultWriteObject();
}
}

View File

@ -10,7 +10,6 @@ details. */
package java.text;
import java.io.Serializable;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@ -24,7 +23,7 @@ import java.util.ResourceBundle;
* Status: Believed complete and correct to 1.1.
*/
public abstract class BreakIterator implements Cloneable, Serializable
public abstract class BreakIterator implements Cloneable
{
// The value was discovered by writing a test program.
public static final int DONE = -1;

View File

@ -10,7 +10,6 @@ details. */
package java.text;
import java.io.Serializable;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@ -24,7 +23,7 @@ import java.util.ResourceBundle;
* Status: Mostly complete, but parts stubbed out. Look for FIXME.
*/
public abstract class Collator implements Cloneable, Serializable
public abstract class Collator implements Cloneable
{
public static final int NO_DECOMPOSITION = 0;
public static final int CANONICAL_DECOMPOSITION = 1;

View File

@ -89,6 +89,8 @@ public class GregorianCalendar extends Calendar {
3600000 /* DST_OFFSET */
};
private static final long serialVersionUID = -8125100834729963327L;
public GregorianCalendar ()
{
this(null, null);

View File

@ -33,6 +33,8 @@ public class Properties extends Hashtable
{
protected Properties defaults;
private static final long serialVersionUID = 4112578634029874840L;
public String getProperty (String propName)
{
return getProperty (propName, null);

View File

@ -26,15 +26,17 @@ import java.io.Serializable;
public class Random implements Serializable
{
/* Used by next() to hold the state of the pseudorandom number generator */
protected long seed;
private long seed;
/* Used by nextGaussian() to hold a precomputed value */
/* to be delivered by that method the next time it is called */
protected double nextNextGaussian;
private double nextNextGaussian;
/* Used by nextGaussian() to keep track of whether it is has precomputed */
/* and stashed away the next value to be delivered by that method */
protected boolean haveNextNextGaussian = false;
private boolean haveNextNextGaussian = false;
private static final long serialVersionUID = 3905348978240129619L;
public Random()
{

View File

@ -71,4 +71,6 @@ public class Stack extends Vector
return -1;
}
private static final long serialVersionUID = 1224463164541339165L;
}

View File

@ -30,6 +30,8 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
private static TimeZone zoneDefault;
private static final long serialVersionUID = 3581463369166924961L;
public TimeZone ()
{
}

View File

@ -61,6 +61,8 @@ public class Vector implements Cloneable, Serializable
/* The buffer in which elements of this vector are stored */
protected Object[] elementData;
private static final long serialVersionUID = -2767605614048989439L;
public Vector()
{
this(10, 0);