Casey Marshall wrote:
On Dec 13, 2006, at 12:21 PM, David Daney wrote:
Casey Marshall wrote:
On Dec 13, 2006, at 12:56 AM, Marco Trudel wrote:
Hey guys
java.util.Arrays.binarySearch(Object[] a, Object key, Comparator
c) exchanges a[i] and key, this can lead to ClassCastExceptions
as shown in ComparatorTest.java. Arrays.patch fixes it.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30061
This exact problem bit me once. I developed code on the RI that
inadvertently had a comparator that depended on the order of the
arguments.
I freely admit that my code was incorrect, but it did take me a
while to figure out what was happening.
I feel that if there is no performance penalty, then we should follow
the behavior of the RI.
I agree, since we have a patch. As long as it tests out OK, I'm not
opposed to including it.
In general I really urge against going out of our way to support
behavior like this.
I changed my mind! As a matter of principle, since I had to fix my
code, everyone should have to suffer in the same manner, as their
penalty for disobeying the mandates of the specification! :)
David Daney