LocaleData_en.java (monetarySeparator): Added.

* gnu/gcj/text/LocaleData_en.java (monetarySeparator): Added.
	* java/sql/Date.java (serialVersionUID): New field.
	* java/sql/Time.java (serialVersionUID): New field.
	* java/sql/Timestamp.java (serialVersionUID): New field.
	* java/text/ChoiceFormat.java (serialVersionUID): New field.
	* java/text/DateFormat.java (getDateTimeInstance (int)): Removed.
	* java/text/DateFormatSymbols.java (serialVersionUID): New field.
	* java/text/DecimalFormat.java (serialVersionOnStream): New field.
	(readObject): New serialization method.
	* java/text/DecimalFormatSymbols.java (monetarySeparator): New field.
	(serialVersionOnStream): New field.
	(readObject): New serialization method.
	(getMonetaryDecimalSeparator): New method.
	(setMonetaryDecimalSeparator): New method.
	* java/text/NumberFormat.java (maxFractionDigits): New field.
	(maxIntegerDigits): New field.
	(minFractionDigits): New field.
	(minIntegerDigits): New field.
	(serialVersionOnStream): New field.
	(serialVersionUID): New field.
	(readObject): New serialization method.
	(writeObject): New serialization method.
	* java/text/SimpleDateFormat.java (defaultCenturyStart): Initialized.
	(serialVersionOnStream): New field.
	(serialVersionUID): New field.
	(readObject): New serialization method.

Serialization mods.

From-SVN: r36831
This commit is contained in:
Warren Levy 2000-10-10 23:09:08 +00:00 committed by Warren Levy
parent 2e165c53de
commit 01ce962b94
12 changed files with 169 additions and 23 deletions

View File

@ -1,3 +1,32 @@
2000-10-10 Warren Levy <warrenl@cygnus.com>
* gnu/gcj/text/LocaleData_en.java (monetarySeparator): Added.
* java/sql/Date.java (serialVersionUID): New field.
* java/sql/Time.java (serialVersionUID): New field.
* java/sql/Timestamp.java (serialVersionUID): New field.
* java/text/ChoiceFormat.java (serialVersionUID): New field.
* java/text/DateFormat.java (getDateTimeInstance (int)): Removed.
* java/text/DateFormatSymbols.java (serialVersionUID): New field.
* java/text/DecimalFormat.java (serialVersionOnStream): New field.
(readObject): New serialization method.
* java/text/DecimalFormatSymbols.java (monetarySeparator): New field.
(serialVersionOnStream): New field.
(readObject): New serialization method.
(getMonetaryDecimalSeparator): New method.
(setMonetaryDecimalSeparator): New method.
* java/text/NumberFormat.java (maxFractionDigits): New field.
(maxIntegerDigits): New field.
(minFractionDigits): New field.
(minIntegerDigits): New field.
(serialVersionOnStream): New field.
(serialVersionUID): New field.
(readObject): New serialization method.
(writeObject): New serialization method.
* java/text/SimpleDateFormat.java (defaultCenturyStart): Initialized.
(serialVersionOnStream): New field.
(serialVersionUID): New field.
(readObject): New serialization method.
2000-10-09 Alexandre Oliva <aoliva@redhat.com>
* configure.in (GCJ): Avoid bogus error message when looking for

View File

@ -1,6 +1,6 @@
// Generic English locale data for java.text.
/* Copyright (C) 1999 Free Software Foundation
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -48,6 +48,7 @@ public final class LocaleData_en extends ListResourceBundle
{ "groupingSeparator", "," },
{ "infinity", "\u221e" },
{ "minusSign", "-" },
{ "monetarySeparator", "." },
{ "NaN", "\ufffd" },
{ "patternSeparator", ";" },
{ "percent", "%" },

View File

@ -1,5 +1,5 @@
/* Date.java -- Wrapper around java.util.Date
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -35,7 +35,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Date extends java.util.Date implements java.io.Serializable
public class Date extends java.util.Date
{
/*
@ -47,6 +47,11 @@ public class Date extends java.util.Date implements java.io.Serializable
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/**
* This is the serialization UID for this class.
*/
private static final long serialVersionUID = 1511598038487230103L;
/*************************************************************************/
/*

View File

@ -1,5 +1,5 @@
/* Time.java -- Wrapper around java.util.Date
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -35,7 +35,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Time extends java.util.Date implements java.io.Serializable
public class Time extends java.util.Date
{
/*
@ -47,6 +47,11 @@ public class Time extends java.util.Date implements java.io.Serializable
*/
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
/**
* This is the serialization UID for this class.
*/
private static final long serialVersionUID = 8397324403548013681L;
/*************************************************************************/
/*

View File

@ -1,5 +1,5 @@
/* Time.java -- Wrapper around java.util.Date
Copyright (C) 1999 Free Software Foundation, Inc.
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -39,7 +39,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Timestamp extends java.util.Date implements java.io.Serializable
public class Timestamp extends java.util.Date
{
/*
@ -56,6 +56,11 @@ private static SimpleDateFormat parse_sdf =
private static SimpleDateFormat format_sdf =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
* This is the serialization UID for this class.
*/
private static final long serialVersionUID = 3581463369166924961L;
/*************************************************************************/
/*

View File

@ -307,4 +307,6 @@ public class ChoiceFormat extends NumberFormat
private static final int mantissaBits = 52;
// Number of exponent bits in a double.
private static final int exponentBits = 11;
private static final long serialVersionUID = 1795184449645032964L;
}

View File

@ -219,11 +219,6 @@ public abstract class DateFormat extends Format implements Cloneable
return getDateTimeInstance (DEFAULT, DEFAULT, Locale.getDefault());
}
public static final DateFormat getDateTimeInstance (int style)
{
return getDateTimeInstance (style, style, Locale.getDefault());
}
public static final DateFormat getDateTimeInstance (int dateStyle,
int timeStyle)
{

View File

@ -33,6 +33,8 @@ public class DateFormatSymbols extends Object
private String[] weekdays;
private String[][] zoneStrings;
private static final long serialVersionUID = -5987973545549424702L;
private static final String[] ampmsDefault = {"AM", "PM" };
private static final String[] erasDefault = {"BC", "AD" };
// localPatternCharsDefault is used by SimpleDateFormat.

View File

@ -1,6 +1,6 @@
// DecimalFormat.java - Localized number formatting.
/* Copyright (C) 1999 Free Software Foundation
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -13,6 +13,8 @@ package java.text;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.io.ObjectInputStream;
import java.io.IOException;
/**
* @author Tom Tromey <tromey@cygnus.com>
@ -20,7 +22,7 @@ import java.util.ResourceBundle;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
* Status: Believed complete and correct to 1.2, except serialization.
* Status: Believed complete and correct to 1.2.
* Note however that the docs are very unclear about how format parsing
* should work. No doubt there are problems here.
*/
@ -976,8 +978,21 @@ public class DecimalFormat extends NumberFormat
private String negativeSuffix;
private String positivePrefix;
private String positiveSuffix;
private int serialVersionOnStream = 1;
private DecimalFormatSymbols symbols;
private boolean useExponentialNotation;
private static final long serialVersionUID = 864413376551465018L;
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
if (serialVersionOnStream < 1)
{
useExponentialNotation = false;
serialVersionOnStream = 1;
}
}
// The locale-independent pattern symbols happen to be the same as
// the US symbols.

View File

@ -1,6 +1,6 @@
// DecimalFormatSymbols.java - Symbols used to format numbers.
/* Copyright (C) 1999 Free Software Foundation
/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@ -14,6 +14,8 @@ import java.io.Serializable;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.io.ObjectInputStream;
import java.io.IOException;
/**
* @author Tom Tromey <tromey@cygnus.com>
@ -21,7 +23,7 @@ import java.util.ResourceBundle;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
* Status: Believed complete and correct to 1.2, except serialization.
* Status: Believed complete and correct to 1.2.
*/
public final class DecimalFormatSymbols implements Cloneable, Serializable
@ -40,6 +42,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
this.groupingSeparator = orig.groupingSeparator;
this.infinity = orig.infinity;
this.intlCurrencySymbol = orig.intlCurrencySymbol;
this.monetarySeparator = orig.monetarySeparator;
this.minusSign = orig.minusSign;
this.NaN = orig.NaN;
this.patternSeparator = orig.patternSeparator;
@ -107,6 +110,14 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
infinity = safeGetString (res, "infinity", "\u221e");
// FIXME: default?
intlCurrencySymbol = safeGetString (res, "intlCurrencySymbol", "$");
try
{
monetarySeparator = safeGetChar (res, "monetarySeparator", '.');
}
catch (MissingResourceException x)
{
monetarySeparator = decimalSeparator;
}
minusSign = safeGetChar (res, "minusSign", '-');
NaN = safeGetString (res, "NaN", "\ufffd");
patternSeparator = safeGetChar (res, "patternSeparator", ';');
@ -128,6 +139,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
&& infinity.equals(dfs.infinity)
&& intlCurrencySymbol.equals(dfs.intlCurrencySymbol)
&& minusSign == dfs.minusSign
&& monetarySeparator == dfs.monetarySeparator
&& NaN.equals(dfs.NaN)
&& patternSeparator == dfs.patternSeparator
&& percent == dfs.percent
@ -176,6 +188,11 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
return minusSign;
}
public char getMonetaryDecimalSeparator ()
{
return monetarySeparator;
}
public String getNaN ()
{
return NaN;
@ -250,6 +267,11 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
this.minusSign = minusSign;
}
public void setMonetaryDecimalSeparator (char decimalSep)
{
monetarySeparator = decimalSep;
}
public void setNaN (String nan)
{
NaN = nan;
@ -285,9 +307,24 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable
private String infinity;
private String intlCurrencySymbol;
private char minusSign;
private char monetarySeparator;
private String NaN;
private char patternSeparator;
private char percent;
private char perMill;
private int serialVersionOnStream = 1;
private char zeroDigit;
private static final long serialVersionUID = 5772796243397350300L;
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
if (serialVersionOnStream < 1)
{
monetarySeparator = decimalSeparator;
exponential = 'E';
serialVersionOnStream = 1;
}
}
}

View File

@ -11,6 +11,9 @@ package java.text;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
/**
* @author Tom Tromey <tromey@cygnus.com>
@ -18,8 +21,7 @@ import java.util.MissingResourceException;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 from http://www.javasoft.com.
* Status: Believed complete and correct to 1.2, except serialization
* and getAvailableLocales.
* Status: Believed complete and correct to 1.2, except getAvailableLocales.
*/
public abstract class NumberFormat extends Format implements Cloneable
@ -249,13 +251,44 @@ public abstract class NumberFormat extends Format implements Cloneable
}
// These field names are fixed by the serialization spec.
// FIXME: serialization spec also mentions `byte' versions of the
// min/max fields. We have no use for those, so for now they are
// omitted.
protected boolean groupingUsed;
protected int maximumFractionDigits;
private byte maxFractionDigits;
protected int maximumIntegerDigits;
private byte maxIntegerDigits;
protected int minimumFractionDigits;
private byte minFractionDigits;
protected int minimumIntegerDigits;
private byte minIntegerDigits;
protected boolean parseIntegerOnly;
private int serialVersionOnStream;
private static final long serialVersionUID = -2308460125733713944L;
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
if (serialVersionOnStream < 1)
{
maximumFractionDigits = maxFractionDigits;
maximumIntegerDigits = maxIntegerDigits;
minimumFractionDigits = minFractionDigits;
minimumIntegerDigits = minIntegerDigits;
serialVersionOnStream = 1;
}
}
private void writeObject(ObjectOutputStream stream) throws IOException
{
maxFractionDigits = maximumFractionDigits < Byte.MAX_VALUE ?
(byte) maximumFractionDigits : Byte.MAX_VALUE;
maxIntegerDigits = maximumIntegerDigits < Byte.MAX_VALUE ?
(byte) maximumIntegerDigits : Byte.MAX_VALUE;
minFractionDigits = minimumFractionDigits < Byte.MAX_VALUE ?
(byte) minimumFractionDigits : Byte.MAX_VALUE;
minIntegerDigits = minimumIntegerDigits < Byte.MAX_VALUE ?
(byte) minimumIntegerDigits : Byte.MAX_VALUE;
serialVersionOnStream = 1;
stream.defaultWriteObject();
}
}

View File

@ -9,6 +9,8 @@ details. */
package java.text;
import java.util.*;
import java.io.ObjectInputStream;
import java.io.IOException;
/**
* @author Per Bothner <bothner@cygnus.com>
@ -16,14 +18,29 @@ import java.util.*;
*/
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: parse is not implemented.
* Status: Believed complete and correct to 1.2.
*/
public class SimpleDateFormat extends DateFormat
{
private Date defaultCenturyStart;
// Serialization fields.
private Date defaultCenturyStart = new Date();
private DateFormatSymbols formatData;
private String pattern;
private int serialVersionOnStream = 1;
private static final long serialVersionUID = 4774881970558875024L;
// Serialization method.
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
stream.defaultReadObject();
if (serialVersionOnStream < 1)
{
defaultCenturyStart = new Date();
serialVersionOnStream = 1;
}
}
public SimpleDateFormat ()
{