Re: Collections.binarySearch and poorly written comparators
> "Jim" == Jim Murphy <[EMAIL PROTECTED]> writes: Jim> The bad comparator implementation assumes that o1 is a Foo and o2 Jim> is a Bar. This "works" when running on the Sum JRE Jim> implementation of Ccollections.binarySearch but fails with the Jim> CLASSPATH's implementation because the types are transposed. Yeah. We actually hit this in Eclipse once. In that case we were able to fix it upstream. Jim> If a goal of CLASSPATH is to be broadly useful does being "bug for bug" Jim> compatible matter to you guys? Would you consider this a bug? There's no question that there is a bug in the library you're using :-) I'm ambivalent about fixing this in Classpath. There was a similar case recently where in the end I think we decided not to make a decision... I guess you could force the issue by writing a patch for review. Then somebody would actually have to take a stand. Tom ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath
Collections.binarySearch and poorly written comparators
Hi all, We're using CLASSPATH together with our code and a 3rd party library. The library contains some poorly written comparators and uses of Collections.binarySearch. I say poorly written because in the comparator implementation there is assumptions about the object types and that assumption is causing me grief by way of a ClassCastException. >From the comparator interface: int compare(Object o1, Object o2); The bad comparator implementation assumes that o1 is a Foo and o2 is a Bar. This "works" when running on the Sum JRE implementation of Ccollections.binarySearch but fails with the CLASSPATH's implementation because the types are transposed. I will have a tough time changing the 3rd party library so I feel a little stuck. Any suggestions? If a goal of CLASSPATH is to be broadly useful does being "bug for bug" compatible matter to you guys? Would you consider this a bug? Jim Murphy ___ Classpath mailing list Classpath@gnu.org http://lists.gnu.org/mailman/listinfo/classpath