* Patch: FYI: Arrays patch
@ 2007-01-23 23:07 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2007-01-23 23:07 UTC (permalink / raw)
To: GCJ-patches
I'm checking this in on the 4.2 branch, the trunk, and the RH 4.1
merge branch.
This patch was a bit controversial when proposed for Classpath.
Please track the discussion there.
Tom
Index: ChangeLog
from Marco Trudel <mtrudel@gmx.ch>
* java/util/Arrays.java (binarySearch): Change comparison order.
Index: java/util/Arrays.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Arrays.java,v
retrieving revision 1.34
diff -u -r1.34 Arrays.java
--- java/util/Arrays.java 8 Jan 2007 17:55:34 -0000 1.34
+++ java/util/Arrays.java 20 Jan 2007 02:01:37 -0000
@@ -1,5 +1,5 @@
/* Arrays.java -- Utility class with methods to operate on arrays
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -639,10 +639,13 @@
while (low <= hi)
{
mid = (low + hi) >>> 1;
- final int d = Collections.compare(key, a[mid], c);
+ // NOTE: Please keep the order of a[mid] and key. Although
+ // not required by the specs, the RI has it in this order as
+ // well, and real programs (erroneously) depend on it.
+ final int d = Collections.compare(a[mid], key, c);
if (d == 0)
return mid;
- else if (d < 0)
+ else if (d > 0)
hi = mid - 1;
else
// This gets the insertion point right on the last loop
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-01-23 23:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23 23:07 Patch: FYI: Arrays patch Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).