Skip to content

Commit 860181f

Browse files
author
joe.walnes
committed
Cleaned up isInstanceOf
1 parent 65bf8b7 commit 860181f

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
/**
1212
* Tests whether the value is an instance of a class.
1313
*/
14-
public class IsInstanceOf<T> extends BaseMatcher<T> {
15-
private final Class<T> theClass;
14+
public class IsInstanceOf extends BaseMatcher<Object> {
15+
private final Class<?> theClass;
1616

1717
/**
1818
* Creates a new instance of IsInstanceOf
1919
*
2020
* @param theClass The predicate evaluates to true for instances of this class
2121
* or one of its subclasses.
2222
*/
23-
public IsInstanceOf(Class<T> theClass) {
23+
public IsInstanceOf(Class<?> theClass) {
2424
this.theClass = theClass;
2525
}
2626

@@ -37,14 +37,8 @@ public void describeTo(Description description) {
3737
* Is the value an instance of a particular type?
3838
*/
3939
@Factory
40-
public static <T> Matcher<T> instanceOf2(Class<T> type) {
41-
return new IsInstanceOf<T>(type);
42-
}
43-
44-
@Factory
45-
@SuppressWarnings({"unchecked"})
46-
public static Matcher<Object> instanceOf(Class type) {
47-
return new IsInstanceOf<Object>(type);
40+
public static Matcher<Object> instanceOf(Class<?> type) {
41+
return new IsInstanceOf(type);
4842
}
4943

5044
}

0 commit comments

Comments
 (0)