diff options
author | Tom Tromey <tromey@redhat.com> | 2006-09-27 07:58:11 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2006-09-27 07:58:11 +0000 |
commit | d79d57fa02ceab03bd4e22945ff7d18248c9d654 (patch) | |
tree | 80f0820b20e882592809e7b0bfae5de14b33cb3b /libjava/java/util/Locale.java | |
parent | 6ae72522633c60b658bf19bc304c4f9fb49f372a (diff) | |
download | gcc-d79d57fa02ceab03bd4e22945ff7d18248c9d654.zip gcc-d79d57fa02ceab03bd4e22945ff7d18248c9d654.tar.gz gcc-d79d57fa02ceab03bd4e22945ff7d18248c9d654.tar.bz2 |
Locale.java (hashcode): No longer transient.
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=201712
* java/util/Locale.java (hashcode): No longer transient.
(writeObject): Use ObjectOutputStream.PutField and
defaultWriteObject.
(readObject): Use defaultReadObject.
From-SVN: r117248
Diffstat (limited to 'libjava/java/util/Locale.java')
-rw-r--r-- | libjava/java/util/Locale.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libjava/java/util/Locale.java b/libjava/java/util/Locale.java index d9ecd1a..03689aa 100644 --- a/libjava/java/util/Locale.java +++ b/libjava/java/util/Locale.java @@ -1,5 +1,5 @@ /* Locale.java -- i18n locales - Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -190,7 +190,7 @@ public final class Locale implements Serializable, Cloneable * * @serial should be -1 in serial streams */ - private transient int hashcode; + private int hashcode; /** * The default locale. Except for during bootstrapping, this should never be @@ -839,11 +839,9 @@ public final class Locale implements Serializable, Cloneable private void writeObject(ObjectOutputStream s) throws IOException { - s.writeObject(language); - s.writeObject(country); - s.writeObject(variant); - // Hashcode field is always written as -1. - s.writeInt(-1); + ObjectOutputStream.PutField fields = s.putFields(); + fields.put("hashcode", -1); + s.defaultWriteObject(); } /** @@ -857,10 +855,10 @@ public final class Locale implements Serializable, Cloneable private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { - language = ((String) s.readObject()).intern(); - country = ((String) s.readObject()).intern(); - variant = ((String) s.readObject()).intern(); - // Recompute hashcode. + s.defaultReadObject(); + language = language.intern(); + country = country.intern(); + variant = variant.intern(); hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode(); } } // class Locale |