JavaHamcrest icon indicating copy to clipboard operation
JavaHamcrest copied to clipboard

comparator method don't accept all possible comparable objects

Open bjrke opened this issue 5 years ago • 0 comments

https://avro.apache.org/ for example creates classes which implement Comparable<SpecificRecord> but not Comparable<ClassName>. Instead every avro class extends SpecificRecordBase which also contains the implementation of compareTo. Because of this its not easy to use matchers like lessThan.

A solution is to replace Comparable<T> with Comparable<? super T> like I did in my PR https://github.com/hamcrest/JavaHamcrest/pull/327

bjrke avatar Feb 11 '21 17:02 bjrke