Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change signature of all comparator methods #327

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions hamcrest/src/main/java/org/hamcrest/Matchers.java
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ public static org.hamcrest.Matcher<java.math.BigDecimal> closeTo(java.math.BigDe
*
* @param value the value which, when passed to the compareTo method of the examined object, should return zero
*/
public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> comparesEqualTo(T value) {
public static <T extends java.lang.Comparable<? super T>> org.hamcrest.Matcher<T> comparesEqualTo(T value) {
return org.hamcrest.number.OrderingComparison.comparesEqualTo(value);
}

Expand All @@ -1313,7 +1313,7 @@ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> compar
* @param value the value which, when passed to the compareTo method of the examined object, should return greater
* than zero
*/
public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThan(T value) {
public static <T extends java.lang.Comparable<? super T>> org.hamcrest.Matcher<T> greaterThan(T value) {
return org.hamcrest.number.OrderingComparison.greaterThan(value);
}

Expand All @@ -1327,7 +1327,7 @@ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greate
* @param value the value which, when passed to the compareTo method of the examined object, should return greater
* than or equal to zero
*/
public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greaterThanOrEqualTo(T value) {
public static <T extends java.lang.Comparable<? super T>> org.hamcrest.Matcher<T> greaterThanOrEqualTo(T value) {
return org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo(value);
}

Expand All @@ -1341,7 +1341,7 @@ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> greate
* @param value the value which, when passed to the compareTo method of the examined object, should return less
* than zero
*/
public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThan(T value) {
public static <T extends java.lang.Comparable<? super T>> org.hamcrest.Matcher<T> lessThan(T value) {
return org.hamcrest.number.OrderingComparison.lessThan(value);
}

Expand All @@ -1355,7 +1355,7 @@ public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessTh
* @param value the value which, when passed to the compareTo method of the examined object, should return less
* than or equal to zero
*/
public static <T extends java.lang.Comparable<T>> org.hamcrest.Matcher<T> lessThanOrEqualTo(T value) {
public static <T extends java.lang.Comparable<? super T>> org.hamcrest.Matcher<T> lessThanOrEqualTo(T value) {
return org.hamcrest.number.OrderingComparison.lessThanOrEqualTo(value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public final class ComparatorMatcherBuilder<T> {
* For example:
* <pre>assertThat(1, ComparatorMatcherBuilder.&lt;Integer&gt;usingNaturalOrdering().lessThanOrEqualTo(1))</pre>
*/
public static <T extends Comparable<T>> ComparatorMatcherBuilder<T> usingNaturalOrdering() {
public static <T extends Comparable<? super T>> ComparatorMatcherBuilder<T> usingNaturalOrdering() {
return new ComparatorMatcherBuilder<T>(new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private OrderingComparison() {
*
* @param value the value which, when passed to the compareTo method of the examined object, should return zero
*/
public static <T extends Comparable<T>> Matcher<T> comparesEqualTo(T value) {
public static <T extends Comparable<? super T>> Matcher<T> comparesEqualTo(T value) {
return ComparatorMatcherBuilder.<T>usingNaturalOrdering().comparesEqualTo(value);
}

Expand All @@ -31,7 +31,7 @@ public static <T extends Comparable<T>> Matcher<T> comparesEqualTo(T value) {
* @param value the value which, when passed to the compareTo method of the examined object, should return greater
* than zero
*/
public static <T extends Comparable<T>> Matcher<T> greaterThan(T value) {
public static <T extends Comparable<? super T>> Matcher<T> greaterThan(T value) {
return ComparatorMatcherBuilder.<T>usingNaturalOrdering().greaterThan(value);
}

Expand All @@ -45,7 +45,7 @@ public static <T extends Comparable<T>> Matcher<T> greaterThan(T value) {
* @param value the value which, when passed to the compareTo method of the examined object, should return greater
* than or equal to zero
*/
public static <T extends Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value) {
public static <T extends Comparable<? super T>> Matcher<T> greaterThanOrEqualTo(T value) {
return ComparatorMatcherBuilder.<T>usingNaturalOrdering().greaterThanOrEqualTo(value);
}

Expand All @@ -59,7 +59,7 @@ public static <T extends Comparable<T>> Matcher<T> greaterThanOrEqualTo(T value)
* @param value the value which, when passed to the compareTo method of the examined object, should return less
* than zero
*/
public static <T extends Comparable<T>> Matcher<T> lessThan(T value) {
public static <T extends Comparable<? super T>> Matcher<T> lessThan(T value) {
return ComparatorMatcherBuilder.<T>usingNaturalOrdering().lessThan(value);
}

Expand All @@ -73,7 +73,7 @@ public static <T extends Comparable<T>> Matcher<T> lessThan(T value) {
* @param value the value which, when passed to the compareTo method of the examined object, should return less
* than or equal to zero
*/
public static <T extends Comparable<T>> Matcher<T> lessThanOrEqualTo(T value) {
public static <T extends Comparable<? super T>> Matcher<T> lessThanOrEqualTo(T value) {
return ComparatorMatcherBuilder.<T>usingNaturalOrdering().lessThanOrEqualTo(value);
}
}