This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.util and java.text merging with classpath
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Sat, 21 Jun 2003 14:46:07 +0200
- Subject: FYI: Patch: java.util and java.text merging with classpath
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached patch to trunk to merge java.util and
java.text changes from classpath to libgcj.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+9FOPWSOgCCdjSDsRAqApAJ9Mx2jjbOsj3N6omYWaaAh7gZhw1QCdHi+y
1Cev42upKZN8tXPpIKRIO9M=
=mhud
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1975
diff -u -b -B -r1.1975 ChangeLog
--- ChangeLog 21 Jun 2003 12:02:09 -0000 1.1975
+++ ChangeLog 21 Jun 2003 12:38:28 -0000
@@ -1,5 +1,12 @@
2003-06-21 Michael Koch <konqueror@gmx.de>
+ * java/text/DateFormat.java,
+ java/text/SimpleDateFormat.java,
+ java/util/Locale.java:
+ New versions from classpath.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
* javax/swing/SpinnerModel.java:
New file from classpath.
* javax/swing/border/LineBorder.java,
Index: java/text/DateFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/DateFormat.java,v
retrieving revision 1.8
diff -u -b -B -r1.8 DateFormat.java
--- java/text/DateFormat.java 22 Jan 2002 22:40:37 -0000 1.8
+++ java/text/DateFormat.java 21 Jun 2003 12:38:28 -0000
@@ -101,7 +101,7 @@
* <ul>
* <li>Is not <code>null</code>.
* <li>Is an instance of <code>DateFormat</code>.
- * <li>Has the same calendar and numberFormat field values as this object.
+ * <li>Has the same numberFormat field value as this object.
* </ul>
*
* @param obj The object to test for equality against.
@@ -111,10 +111,12 @@
*/
public boolean equals (Object obj)
{
- if (! (obj instanceof DateFormat))
+ if (!(obj instanceof DateFormat))
return false;
+
DateFormat d = (DateFormat) obj;
- return calendar.equals(d.calendar) && numberFormat.equals(d.numberFormat);
+
+ return numberFormat.equals(d.numberFormat);
}
/**
@@ -467,10 +469,10 @@
*/
public int hashCode ()
{
- int hash = calendar.hashCode();
if (numberFormat != null)
- hash ^= numberFormat.hashCode();
- return hash;
+ return numberFormat.hashCode();
+ else
+ return 0;
}
/**
Index: java/text/SimpleDateFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/SimpleDateFormat.java,v
retrieving revision 1.17
diff -u -b -B -r1.17 SimpleDateFormat.java
--- java/text/SimpleDateFormat.java 8 Jun 2003 19:00:02 -0000 1.17
+++ java/text/SimpleDateFormat.java 21 Jun 2003 12:38:29 -0000
@@ -384,16 +384,27 @@
SimpleDateFormat sdf = (SimpleDateFormat)o;
- if (!toPattern().equals(sdf.toPattern()))
+ if (defaultCentury != sdf.defaultCentury)
return false;
- if (!get2DigitYearStart().equals(sdf.get2DigitYearStart()))
+ if (!toPattern().equals(sdf.toPattern()))
return false;
if (!getDateFormatSymbols().equals(sdf.getDateFormatSymbols()))
return false;
return true;
+ }
+
+ /**
+ * This method returns a hash value for this object.
+ *
+ * @return A hash value for this object.
+ */
+ public int hashCode()
+ {
+ return super.hashCode() ^ toPattern().hashCode() ^ defaultCentury ^
+ getDateFormatSymbols().hashCode();
}
Index: java/util/Locale.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/Locale.java,v
retrieving revision 1.13
diff -u -b -B -r1.13 Locale.java
--- java/util/Locale.java 18 Jun 2003 08:15:42 -0000 1.13
+++ java/util/Locale.java 21 Jun 2003 12:38:29 -0000
@@ -231,9 +231,9 @@
// default locale.
if (defaultLocale != null)
{
- language = convertLanguage(language);
- country = country.toUpperCase();
- variant = variant.toUpperCase();
+ language = convertLanguage(language).intern();
+ country = country.toUpperCase().intern();
+ variant = variant.toUpperCase().intern();
}
this.language = language;
this.country = country;
@@ -436,7 +436,7 @@
*/
public String getISO3Language()
{
- if ("".equals(language))
+ if (language == "")
return "";
int index
= ("aa,ab,af,am,ar,as,ay,az,ba,be,bg,bh,bi,bn,bo,br,ca,co,cs,cy,da,"
@@ -472,7 +472,7 @@
*/
public String getISO3Country()
{
- if ("".equals(country))
+ if (country == "")
return "";
int index
= ("AD,AE,AF,AG,AI,AL,AM,AN,AO,AQ,AR,AS,AT,AU,AW,AZ,BA,BB,BD,BE,BF,"
@@ -729,9 +729,13 @@
return false;
Locale l = (Locale) obj;
- return (language.equals(l.language)
- && country.equals(l.country)
- && variant.equals(l.variant));
+ // ??? We might also want to add:
+ // hashCode() == l.hashCode()
+ // But this is a synchronized method. Is the overhead worth it?
+ // Measure this to make a decision.
+ return (language == l.language
+ && country == l.country
+ && variant == l.variant);
}
/**