Skip to content

Commit 1b571e7

Browse files
author
smgfreeman
committed
sf Compiles and builds on a Mac.
1 parent 882e781 commit 1b571e7

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎hamcrest-core/src/main/java/org/hamcrest/core/IsEqual.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static boolean isArray(Object o) {
6464
* {@link java.lang.Object#equals} invokedMethod?
6565
*/
6666
@Factory
67-
public static <T> Matcher<T> equalTo(T operand) {
67+
public static <T> Matcher<? super T> equalTo(T operand) {
6868
return new IsEqual<T>(operand);
6969
}
7070
}

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsArray.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* The array size must equal the number of element matchers.
1212
*/
1313
public class IsArray<T> extends TypeSafeMatcher<T[]> {
14-
private final Matcher<T>[] elementMatchers;
14+
private final Matcher<? super T>[] elementMatchers;
1515

16-
public IsArray(Matcher<T>[] elementMatchers) {
16+
public IsArray(Matcher<? super T>[] elementMatchers) {
1717
this.elementMatchers = elementMatchers.clone();
1818
}
1919

@@ -66,7 +66,7 @@ protected String descriptionEnd() {
6666
/**
6767
* Evaluates to true only if each matcher[i] is satisfied by array[i].
6868
*/
69-
public static <T> IsArray<T> array(Matcher<T>... elementMatchers) {
69+
public static <T> IsArray<T> array(Matcher<? super T>... elementMatchers) {
7070
return new IsArray<T>(elementMatchers);
7171
}
7272
}

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsCollectionWithSize.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
import static org.hamcrest.core.IsEqual.equalTo;
44

5+
import java.util.Collection;
6+
57
import org.hamcrest.Description;
68
import org.hamcrest.Factory;
79
import org.hamcrest.Matcher;
810
import org.hamcrest.TypeSafeMatcher;
911

10-
import java.util.Collection;
11-
1212
/**
1313
* Matches if collection size satisfies a nested matcher.
1414
*/
@@ -37,6 +37,7 @@ public static <E> Matcher<? super Collection<? extends E>> hasSize(Matcher<? sup
3737
return new IsCollectionWithSize<E>(size);
3838
}
3939

40+
4041
/**
4142
* This is a shortcut to the frequently used hasSize(equalTo(x)).
4243
*

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsEmptyCollection.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.hamcrest.collection;
22

3+
import java.util.Collection;
4+
35
import org.hamcrest.Description;
46
import org.hamcrest.Factory;
57
import org.hamcrest.Matcher;
68
import org.hamcrest.TypeSafeMatcher;
79

8-
import java.util.Collection;
9-
1010
/**
1111
* Tests if collection is empty.
1212
*/

‎hamcrest-library/src/main/java/org/hamcrest/collection/IsMapContainingKey.java‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,20 @@
88
import org.hamcrest.TypeSafeMatcher;
99
import static org.hamcrest.core.IsEqual.equalTo;
1010

11-
12-
public class IsMapContainingKey<K> extends TypeSafeMatcher<Map<K,?>> {
13-
private final Matcher<K> keyMatcher;
11+
public class IsMapContainingKey<K> extends TypeSafeMatcher<Map<? extends K,?>> {
12+
private final Matcher<? super K> keyMatcher;
1413

15-
public IsMapContainingKey(Matcher<K> keyMatcher) {
14+
public IsMapContainingKey(Matcher<? super K> keyMatcher) {
1615
this.keyMatcher = keyMatcher;
1716
}
1817

1918
@Override
20-
public boolean matchesSafely(Map<K, ?> item) {
19+
public boolean matchesSafely(Map<? extends K, ? > item) {
2120
for (K key : item.keySet()) {
2221
if (keyMatcher.matches(key)) {
2322
return true;
2423
}
25-
}
24+
}
2625
return false;
2726
}
2827

@@ -32,12 +31,12 @@ public void describeTo(Description description) {
3231
}
3332

3433
@Factory
35-
public static <K> Matcher<? super Map<K,?>> hasKey(K key) {
34+
public static <K> Matcher<Map<? extends K,?>> hasKey(K key) {
3635
return IsMapContainingKey.<K>hasKey(equalTo(key));
3736
}
3837

3938
@Factory
40-
public static <K> Matcher<? super Map<K,?>> hasKey(Matcher<K> keyMatcher) {
39+
public static <K> Matcher<Map<? extends K,?>> hasKey(Matcher<? super K> keyMatcher) {
4140
return new IsMapContainingKey<K>(keyMatcher);
4241
}
4342
}

‎hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected Matcher<?> createMatcher() {
1414
}
1515

1616
public void testHasAReadableDescription() {
17-
assertDescription("[<1>, <2>] in any order",
17+
assertDescription("[<<1>>, <<2>>] in any order",
1818
arrayContainingInAnyOrder(equalTo(1), equalTo(2)));
1919
}
2020
}

‎hamcrest-unit-test/src/main/java/org/hamcrest/collection/IsArrayContainingInOrderTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ protected Matcher<?> createMatcher() {
1414
}
1515

1616
public void testHasAReadableDescription() {
17-
assertDescription("[<1>, <2>]",
17+
assertDescription("[<<1>>, <<2>>]",
1818
arrayContaining(equalTo(1), equalTo(2)));
1919
}
2020
}

0 commit comments

Comments
 (0)