Skip to content

Commit 90ebec4

Browse files
committed
Corrected type signature in isA.
hamcrest#27
1 parent 10910e5 commit 90ebec4

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

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

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

77
import static org.hamcrest.core.IsEqual.equalTo;
8-
import static org.hamcrest.core.IsInstanceOf.instanceOf;
98

109
/**
1110
* Decorates another Matcher, retaining the behaviour but allowing tests
@@ -46,7 +45,7 @@ public void describeMismatch(Object item, Description mismatchDescription) {
4645
*
4746
*/
4847
public static <T> Matcher<T> is(Matcher<T> matcher) {
49-
return new Is<T>(matcher);
48+
return new Is<>(matcher);
5049
}
5150

5251
/**
@@ -69,8 +68,7 @@ public static <T> Matcher<T> is(T value) {
6968
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
7069
*
7170
*/
72-
public static <T> Matcher<T> isA(Class<T> type) {
73-
final Matcher<T> typeMatcher = instanceOf(type);
74-
return is(typeMatcher);
71+
public static <T> Matcher<T> isA(Class<?> type) {
72+
return is(IsInstanceOf.<T>instanceOf(type));
7573
}
7674
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public final class IsTest {
4343
@SuppressWarnings({ "unchecked", "rawtypes" })
4444
@Test public void
4545
providesConvenientShortcutForIsInstanceOf() {
46-
final Matcher matcher = isA(Integer.class);
46+
final Matcher matcher = isA(Number.class);
4747
assertMatches(matcher, 1);
4848
assertDoesNotMatch(matcher, new Object());
4949
assertDoesNotMatch(matcher, null);

hamcrest-library/src/main/java/org/hamcrest/Matchers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public static <T> org.hamcrest.Matcher<T> is(T value) {
215215
* instead of:
216216
* <pre>assertThat(cheese, is(instanceOf(Cheddar.class)))</pre>
217217
*/
218-
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<T> type) {
218+
public static <T> org.hamcrest.Matcher<T> isA(java.lang.Class<?> type) {
219219
return org.hamcrest.core.Is.isA(type);
220220
}
221221

0 commit comments

Comments
 (0)