Skip to content

Commit 4c4c3fa

Browse files
committed
Merge pull request hamcrest#41 from bjoernpollex/master
Fixed Issue hamcrest#40 - added generic bounds
2 parents a978abe + b138eeb commit 4c4c3fa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hamcrest-core/src/main/java/org/hamcrest/core/Every.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import org.hamcrest.Matcher;
66
import org.hamcrest.TypeSafeDiagnosingMatcher;
77

8-
public class Every<T> extends TypeSafeDiagnosingMatcher<Iterable<T>> {
8+
public class Every<T> extends TypeSafeDiagnosingMatcher<Iterable<? extends T>> {
99
private final Matcher<? super T> matcher;
1010

1111
public Every(Matcher<? super T> matcher) {
1212
this.matcher= matcher;
1313
}
1414

1515
@Override
16-
public boolean matchesSafely(Iterable<T> collection, Description mismatchDescription) {
16+
public boolean matchesSafely(Iterable<? extends T> collection, Description mismatchDescription) {
1717
for (T t : collection) {
1818
if (!matcher.matches(t)) {
1919
mismatchDescription.appendText("an item ");
@@ -40,7 +40,7 @@ public void describeTo(Description description) {
4040
* the matcher to apply to every item provided by the examined {@link Iterable}
4141
*/
4242
@Factory
43-
public static <U> Matcher<Iterable<U>> everyItem(final Matcher<U> itemMatcher) {
43+
public static <U> Matcher<Iterable<? extends U>> everyItem(final Matcher<U> itemMatcher) {
4444
return new Every<U>(itemMatcher);
4545
}
4646
}

hamcrest-core/src/test/java/org/hamcrest/core/EveryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
public final class EveryTest {
1818

19-
private final Matcher<Iterable<String>> matcher = Every.everyItem(containsString("a"));
19+
private final Matcher<Iterable<? extends String>> matcher = Every.everyItem(containsString("a"));
2020

2121
@Test public void
2222
copesWithNullsAndUnknownTypes() {

0 commit comments

Comments
 (0)