Commit b5561639 authored by warrenl's avatar warrenl
Browse files

* Makefile.am: Added locale files from Classpath.

	* Makefile.in: Rebuilt.
	* gnu/java/locale/Calendar.java: New file.
	* gnu/java/locale/Calendar_de.java: New file.
	* gnu/java/locale/Calendar_en.java: New file.
	* gnu/java/locale/Calendar_nl.java: New file.
	* java/lang/ClassNotFoundException.java: Replaced with Classpath file.
	* java/math/BigDecimal.java (intVal): Renamed from 'num' for
	serialization compatibility.
	(scale): Made private.
	(serialVersionUID): New field.
	* java/math/BigInteger.java (ival): Made transient.
	(words): Made transient.
	(bitCount): New serialization field.
	(bitLength): Ditto.
	(firstNonzeroByteNum): Ditto.
	(lowestSetBit): Ditto.
	(magnitude): Ditto.
	(signum): Ditto.
	(serialVersionUID): New field.
	(readObject): New method.
	(writeObject): New method.
	* java/util/BitSet.java (serialVersionUID): New field.
	* java/util/Calendar.java: Replaced with Classpath file.
	* java/util/GregorianCalendar.java (GregorianCalendar): Pass result
	of getDefault() for TimeZone or Locale instead of passing nulls.
	* java/util/Locale.java (serialVersionUID): New field.
	(writeObject): New method.
	(readObject): New method.
	* java/util/SimpleTimeZone.java: Replaced with Classpath file.

Serialization mods.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37080 138bc75d-0d04-0410-961f-82ee72b054a4
parent cbfb00d6
2000-10-27 Warren Levy <warrenl@cygnus.com>
* Makefile.am: Added locale files from Classpath.
* Makefile.in: Rebuilt.
* gnu/java/locale/Calendar.java: New file.
* gnu/java/locale/Calendar_de.java: New file.
* gnu/java/locale/Calendar_en.java: New file.
* gnu/java/locale/Calendar_nl.java: New file.
* java/lang/ClassNotFoundException.java: Replaced with Classpath file.
* java/math/BigDecimal.java (intVal): Renamed from 'num' for
serialization compatibility.
(scale): Made private.
(serialVersionUID): New field.
* java/math/BigInteger.java (ival): Made transient.
(words): Made transient.
(bitCount): New serialization field.
(bitLength): Ditto.
(firstNonzeroByteNum): Ditto.
(lowestSetBit): Ditto.
(magnitude): Ditto.
(signum): Ditto.
(serialVersionUID): New field.
(readObject): New method.
(writeObject): New method.
* java/util/BitSet.java (serialVersionUID): New field.
* java/util/Calendar.java: Replaced with Classpath file.
* java/util/GregorianCalendar.java (GregorianCalendar): Pass result
of getDefault() for TimeZone or Locale instead of passing nulls.
* java/util/Locale.java (serialVersionUID): New field.
(writeObject): New method.
(readObject): New method.
* java/util/SimpleTimeZone.java: Replaced with Classpath file.
2000-10-25 Bryce McKinlay <bryce@albatross.co.nz>
* Makefile.am (GCJCOMPILE): Pass --tag=GCJ to libtool.
......
......@@ -998,6 +998,10 @@ gnu/java/io/ObjectIdentityWrapper.java \
gnu/java/lang/ArrayHelper.java \
gnu/java/lang/ClassHelper.java \
gnu/java/lang/reflect/TypeSignature.java \
gnu/java/locale/Calendar.java \
gnu/java/locale/Calendar_de.java \
gnu/java/locale/Calendar_en.java \
gnu/java/locale/Calendar_nl.java \
gnu/java/security/provider/Gnu.java \
gnu/java/security/provider/SHA.java \
gnu/java/security/provider/SHA1PRNG.java \
......
......@@ -742,6 +742,10 @@ gnu/java/io/ObjectIdentityWrapper.java \
gnu/java/lang/ArrayHelper.java \
gnu/java/lang/ClassHelper.java \
gnu/java/lang/reflect/TypeSignature.java \
gnu/java/locale/Calendar.java \
gnu/java/locale/Calendar_de.java \
gnu/java/locale/Calendar_en.java \
gnu/java/locale/Calendar_nl.java \
gnu/java/security/provider/Gnu.java \
gnu/java/security/provider/SHA.java \
gnu/java/security/provider/SHA1PRNG.java \
......@@ -1256,6 +1260,8 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/io/ObjectIdentityWrapper.P \
.deps/gnu/java/lang/ArrayHelper.P .deps/gnu/java/lang/ClassHelper.P \
.deps/gnu/java/lang/reflect/TypeSignature.P \
.deps/gnu/java/locale/Calendar.P .deps/gnu/java/locale/Calendar_de.P \
.deps/gnu/java/locale/Calendar_en.P .deps/gnu/java/locale/Calendar_nl.P \
.deps/gnu/java/security/provider/Gnu.P \
.deps/gnu/java/security/provider/SHA.P \
.deps/gnu/java/security/provider/SHA1PRNG.P .deps/interpret.P \
......
/* Calendar.java -- Default Calendar locale data
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.locale;
import java.util.ListResourceBundle;
import java.util.Locale;
import java.util.Date;
/**
* This class contains locale data for java.util.Calendar.<br>
*
* If you localize this to another language only set fields, that
* you change. See Calendar_de for an example. Also add your
* locale to this list of availableLocales below in this(!) file.
*
* @author Jochen Hoenicke
*/
public class Calendar extends ListResourceBundle
{
/**
* The locales for which Calendar is localized.
*/
private static final Locale[] availableLocales = {
Locale.GERMAN, Locale.ENGLISH, new Locale("nl", "")
};
/**
* This is the default calendar class, that is returned on
* java.util.Calendar.getInstance().
* @see java.util.Calendar#getInstance()
*/
private static final String calendarClass = "java.util.GregorianCalendar";
/**
* This is used by java.util.Calendar.
* @see java.util.Calendar#getFirstDayOfWeek()
*/
private static final Integer firstDayOfWeek
= new Integer(java.util.Calendar.SUNDAY);
/**
* This is used by java.util.Calendar.
* @see java.util.Calendar#getMinimalDaysInFirstWeek()
*/
private static final Integer minimalDaysInFirstWeek = new Integer(1);
/**
* The point at which the Gregorian calendar rules were used.
* The default for most catholic
* countries is midnight (UTC) on October 5, 1582 (Julian),
* or October 15, 1582 (Gregorian).
* @see java.util.GregorianCalendar#getGregorianCutOver
*/
/* If you change this date be aware, that this formular does only
* work for months from MARCH to DECEMBER and doesn't work in
* leap years (look in java.util.GregorianCalendar.getDayOfYear for
* more info).
*/
private static final Date gregorianCutOver = new Date
((24*60*60*1000L) *
(((1582*(365*4+1))/4 +
(java.util.Calendar.OCTOBER*(31+30+31+30+31) - 9) / 5 + 5) -
((1970*(365*4+1))/4 + 1 - 13)));
/**
* This is the object array used to hold the keys and values
* for this bundle
*/
private static final Object[][] contents =
{
{ "availableLocales", availableLocales },
{ "calendarClass", calendarClass },
{ "firstDayOfWeek", firstDayOfWeek },
{ "minimalDaysInFirstWeek", minimalDaysInFirstWeek },
{ "gregorianCutOver", gregorianCutOver }
};
/**
* This method returns the object array of key, value pairs containing
* the data for this bundle.
*
* @return The key, value information.
*/
public Object[][] getContents()
{
return(contents);
}
}
/* Calendar_de.java -- German calendar locale data
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.locale;
import java.util.ListResourceBundle;
import java.util.Calendar;
/**
* This class contains locale data for java.util.Calendar specific for
* german language.
* @author Jochen Hoenicke
*/
public class Calendar_de extends ListResourceBundle
{
/**
* This is the object array used to hold the keys and values
* for this bundle
*/
private static final Object[][] contents =
{
{ "firstDayOfWeek", new Integer(Calendar.MONDAY) },
{ "minimalDaysInFirstWeek", new Integer(4) },
};
/**
* This method returns the object array of key, value pairs containing
* the data for this bundle.
*
* @return The key, value information.
*/
public Object[][] getContents()
{
return contents;
}
}
/* Calendar_en.java -- English calendar locale data
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.locale;
import java.util.ListResourceBundle;
import java.util.Calendar;
/**
* This class contains locale data for java.util.Calendar specific for
* english language.
* @author Jochen Hoenicke
*/
public class Calendar_en extends ListResourceBundle
{
/**
* This is the object array used to hold the keys and values
* for this bundle
*/
private static final Object[][] contents =
{
/* Use default values. */
};
/**
* This method returns the object array of key, value pairs containing
* the data for this bundle.
*
* @return The key, value information.
*/
public Object[][] getContents()
{
return contents;
}
}
/* Calendar_nl.java -- Dutch calendar locale data
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package gnu.java.locale;
import java.util.ListResourceBundle;
import java.util.Calendar;
/**
* This class contains locale data for java.util.Calendar specific for
* dutch language.
* @author Mark Wielaard
*/
public class Calendar_nl extends ListResourceBundle
{
/**
* This is the object array used to hold the keys and values
* for this bundle
*/
private static final Object[][] contents =
{
{ "firstDayOfWeek", new Integer(Calendar.MONDAY) },
/* XXX - I guess the default for gregorianCutover
* is also true for the Netherlands. But is it?
*/
};
/**
* This method returns the object array of key, value pairs containing
* the data for this bundle.
*
* @return The key, value information.
*/
public Object[][] getContents()
{
return contents;
}
}
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
/* ClassNotFoundException.java -- exception thrown when attempting to load
a class when no definition for the class can be found.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of libgcj.
This file is part of GNU Classpath.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
As a special exception, if you link this library with other files to
produce an executable, this library does not by itself cause the
resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why the
executable file might be covered by the GNU General Public License. */
package java.lang;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date September 18, 1998.
* Exceptions may be thrown by one part of a Java program and caught
* by another in order to deal with exceptional conditions. This
* exception can by thrown by specific methods of <code>ClassLoader</code>
* and <code>Class</code> when attempting to load a class when no definition
* for the specified class can be found.
*
* @since JDK 1.0
*
* @author Brian Jones
*/
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
public class ClassNotFoundException extends Exception
{
// TODO12:
// Throwable ex;
static final long serialVersionUID = 9176873029745254542L;
private Throwable ex = null;
/**
* Create an exception without a message.
*/
public ClassNotFoundException()
{
super();
}
// TODO12:
// public ClassNotFoundException(String msg, Throwable ex)
// {
// FIXME: Set 'ex' here.
// }
public ClassNotFoundException(String msg)
{
super(msg);
}
// TODO12:
// public Throwable getException()
// {
// }
// TBD: if this needs to be implemented
// public void printStackTrace()
// {
// }
// TBD: if this needs to be implemented
// public void printStackTrace(PrintStream ps)
// {
// }
// TBD: if this needs to be implemented
// public void printStackTrace(PrintWriter pw)
// {
// }
{
super();
}
/**
* Create an exception with a message.
*/
public ClassNotFoundException(String s)
{
super(s);
}
/**
* Create an exception with a message and include the exception
* which occurred while loading the class.
*
* @param ex the exception which occurred while loading the class
*
* @since JDK 1.2
*/
public ClassNotFoundException(String s, Throwable ex)
{
super(s);
this.ex = ex;
}
/**
* Returns the exception which occurred while loading the class,
* otherwise returns null.
*
* @since JDK 1.2
*/
public Throwable getException()
{
return ex;
}
/**
* Print a stack trace of the exception that occurred.
*/
public void printStackTrace()
{
if (ex == null)
{
super.printStackTrace();
}
else
{
ex.printStackTrace();
}
}
/**
* Print a stack trace of the exception that occurred to
* the specified <code>PrintStream</code>.
*/
public void printStackTrace(PrintStream ps)
{
if (ex == null)
{
super.printStackTrace(ps);
}
else
{
ex.printStackTrace(ps);
}
}
/**
* Print a stack trace of the exception that occurred to
* the specified <code>PrintWriter</code>.
*/
public void printStackTrace(PrintWriter pw)
{
if (ex == null)
{
super.printStackTrace(pw);
}
else
{
ex.printStackTrace(pw);
}
}
/**
* Serialize the object in a manner binary compatible with the JDK 1.2
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
ObjectOutputStream.PutField oFields;
oFields = s.putFields();
oFields.put("ex", this.ex);
s.writeFields();
}
/**
* Deserialize the object in a manner binary compatible with the JDK 1.2
*/
private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException
{
ObjectInputStream.GetField oFields;
oFields = s.readFields();
ex = (Throwable)oFields.get("ex", (Throwable)null);
}
}
......@@ -29,8 +29,9 @@ package java.math;
import java.math.BigInteger;
public class BigDecimal extends Number implements Comparable {
BigInteger num;
int scale;
private BigInteger intVal;
private int scale;
private static final long serialVersionUID = 6108874887143696463L;
private final static BigDecimal ZERO =
new BigDecimal (BigInteger.valueOf (0), 0);
......@@ -56,7 +57,7 @@ public class BigDecimal extends Number implements Comparable {
{
if (scale < 0)
throw new NumberFormatException ("scale of " + scale + " is < 0");
this.num = num;
this.intVal = num;
this.scale = scale;
}
......@@ -68,7 +69,7 @@ public class BigDecimal extends Number implements Comparable {
public BigDecimal (String num) throws NumberFormatException
{
int point = num.indexOf('.');
this.num = new BigInteger (point == -1 ? num :
this.intVal = new BigInteger (point == -1 ? num :
num.substring (0, point) +
num.substring (point + 1));
scale = num.length() - (point == -1 ? num.length () : point + 1);
......@@ -99,8 +100,8 @@ public class BigDecimal extends Number implements Comparable {
// For addition, need to line up decimals. Note that the movePointRight
// method cannot be used for this as it might return a BigDecimal with
// scale == 0 instead of the scale we need.
BigInteger op1 = num;
BigInteger op2 = val.num;
BigInteger op1 = intVal;
BigInteger op2 = val.intVal;
if (scale < val.scale)
op1 = op1.multiply (BigInteger.valueOf (10).pow (val.scale - scale));
else if (scale > val.scale)
......@@ -116,7 +117,7 @@ public class BigDecimal extends Number implements Comparable {
public BigDecimal multiply (BigDecimal val)
{
return new BigDecimal (num.multiply (val.num), scale + val.scale);
return new BigDecimal (intVal.multiply (val.intVal), scale + val.scale);
}
public BigDecimal divide (BigDecimal val, int roundingMode)
......@@ -135,13 +136,13 @@ public class BigDecimal extends Number implements Comparable {
if (scale < 0)
throw new ArithmeticException ("scale is negative: " + scale);
if (num.signum () == 0) // handle special case of 0.0/0.0
if (intVal.signum () == 0) // handle special case of 0.0/0.0
return ZERO;
BigInteger dividend = num.multiply (BigInteger.valueOf (10).pow
BigInteger dividend = intVal.multiply (BigInteger.valueOf (10).pow
(newScale + 1 - (scale - val.scale)));
BigInteger parts[] = dividend.divideAndRemainder (val.num);
BigInteger parts[] = dividend.divideAndRemainder (val.intVal);
// System.out.println("int: " + parts[0]);
// System.out.println("rem: " + parts[1]);
......@@ -194,12 +195,12 @@ public class BigDecimal extends Number implements Comparable {
public int compareTo (BigDecimal val)
{
if (scale == val.scale)
return num.compareTo (val.num);
return intVal.compareTo (val.intVal);
BigInteger thisParts[] =
num.divideAndRemainder (BigInteger.valueOf (10).pow (scale));
intVal.divideAndRemainder (BigInteger.valueOf (10).pow (scale));
BigInteger valParts[] =
val.num.divideAndRemainder (BigInteger.valueOf (10).pow (val.scale));
val.intVal.divideAndRemainder (BigInteger.valueOf (10).pow (val.scale));
int compare;
if ((compare = thisParts[0].compareTo (valParts[0])) != 0)
......@@ -263,7 +264,7 @@ public class BigDecimal extends Number implements Comparable {
public BigDecimal movePointLeft (int n)
{
return (n < 0) ? movePointRight (-n) : new BigDecimal (num, scale + n);
return (n < 0) ? movePointRight (-n) : new BigDecimal (intVal, scale + n);
}
public BigDecimal movePointRight (int n)
......@@ -272,15 +273,15 @@ public class BigDecimal extends Number implements Comparable {
return movePointLeft (-n);
if (scale >= n)
return new BigDecimal (num, scale - n);
return new BigDecimal (intVal, scale - n);
return new BigDecimal (num.multiply
return new BigDecimal (intVal.multiply
(BigInteger.valueOf (10).pow (n - scale)), 0);
}
public int signum ()
{
return num.signum ();
return intVal.signum ();
}
public int scale ()
......@@ -290,17 +291,17 @@ public class BigDecimal extends Number implements Comparable {
public BigDecimal abs ()
{
return new BigDecimal (num.abs (), scale);
return new BigDecimal (intVal.abs (), scale);
}
public BigDecimal negate ()
{
return new BigDecimal (num.negate (), scale);
return new BigDecimal (intVal.negate (), scale);
}
public String toString ()
{
String bigStr = num.toString();
String bigStr = intVal.toString();
if (scale == 0)
return bigStr;
......@@ -322,7 +323,8 @@ public class BigDecimal extends Number implements Comparable {
public BigInteger toBigInteger ()
{
return scale == 0 ? num : num.divide (BigInteger.valueOf (10).pow (scale));
return scale == 0 ? intVal :
intVal.divide (BigInteger.valueOf (10).pow (scale));
}
......
......@@ -11,6 +11,9 @@ details. */
package java.math;
import gnu.gcj.math.*;
import java.util.Random;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
/**
* @author Warren Levy <warrenl@cygnus.com>
......@@ -35,8 +38,17 @@ public class BigInteger extends Number implements Comparable
* If words == null, the ival is the value of this BigInteger.
* Otherwise, the first ival elements of words make the value
* of this BigInteger, stored in little-endian order, 2's-complement form. */
private int ival;
private int[] words;
transient private int ival;
transient private int[] words;
// Serialization fields.
private int bitCount = -1;
private int bitLength = -1;
private int firstNonzeroByteNum = -2;
private int lowestSetBit = -2;
private byte[] magnitude;
private int signum;
private static final long serialVersionUID = -8287574255936472291L;
/** We pre-allocate integers in the range minFixNum..maxFixNum. */
......@@ -2201,4 +2213,22 @@ public class BigInteger extends Number implements Comparable
}
return isNegative() ? x_len * 32 - i : i;
}
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
words = byteArrayToIntArray(magnitude, signum < 0 ? -1 : 0);
BigInteger result = make(words, words.length);
this.ival = result.ival;
this.words = result.words;
}
private void writeObject(ObjectOutputStream s)
throws IOException, ClassNotFoundException
{
signum = signum();
magnitude = toByteArray();
s.defaultWriteObject();
}
}
......@@ -174,4 +174,5 @@ public final class BitSet implements Cloneable, Serializable
// The actual bits.
private long[] bits;
private static final long serialVersionUID = 7997698588986878753L;
}
This diff is collapsed.
/* Copyright (C) 1998, 1999 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
......@@ -93,17 +93,17 @@ public class GregorianCalendar extends Calendar {
public GregorianCalendar ()
{
this(null, null);
this(TimeZone.getDefault (), Locale.getDefault ());
}
public GregorianCalendar (TimeZone zone)
{
this (zone, null);
this (zone, Locale.getDefault ());
}
public GregorianCalendar (Locale locale)
{
this (null, locale);
this (TimeZone.getDefault (), locale);
}
public GregorianCalendar (TimeZone zone, Locale locale)
......
......@@ -26,6 +26,7 @@ public final class Locale implements java.io.Serializable, Cloneable
private String language;
private String variant;
private static Locale defaultLocale;
private static final long serialVersionUID = 9149081749638150636L;
// These are as specified in the JDK 1.2 AP documentation
......@@ -145,4 +146,28 @@ public final class Locale implements java.io.Serializable, Cloneable
}
return result.toString();
}
/**
* @serialdata According to jdk1.2 the hashcode should always be
* written as -1;
*/
private void writeObject(java.io.ObjectOutputStream output)
throws java.io.IOException
{
int tmpHashcode = hashcode;
hashcode = -1;
output.defaultWriteObject();
hashcode = tmpHashcode;
}
/**
* @serialdata According to jdk1.2 the hashCode is always invalid
* and must be recomputed.
*/
private void readObject(java.io.ObjectInputStream input)
throws java.io.IOException, ClassNotFoundException
{
input.defaultReadObject();
hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode();
}
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment