Skip to content
Browse files

Use <? super T> in Assert.assertThat

Add comments explaining our interpretation of the type parameter on org.hamcrest.Matcher
  • Loading branch information...
1 parent 1cff207 commit 8c2f7890154618b9409ef2baf7d96ccebec8d1ba @fbarber fbarber committed
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/main/java/org/junit/Assert.java
View
10 src/main/java/org/junit/Assert.java
@@ -721,6 +721,11 @@ public static void assertEquals(Object[] expecteds, Object[] actuals) {
* // got value: &lt;0&gt;
* assertThat(0, is(not(1))) // passes
* </pre>
+ *
+ * <code>org.hamcrest.Matcher</code> does not currently document the meaning
+ * of its type parameter <code>T</code>. This method assumes that a matcher
+ * typed as <code>Matcher&lt;T&gt;</code> can be meaningfully applied only
+ * to values that could be assigned to a variable of type <code>T</code>.
*
* @param <T>
* the static type accepted by the matcher (this can flag obvious
@@ -753,6 +758,11 @@ public static void assertEquals(Object[] expecteds, Object[] actuals) {
* assertThat(&quot;Zero is one&quot;, 0, is(not(1))) // passes
* </pre>
*
+ * <code>org.hamcrest.Matcher</code> does not currently document the meaning
+ * of its type parameter <code>T</code>. This method assumes that a matcher
+ * typed as <code>Matcher&lt;T&gt;</code> can be meaningfully applied only
+ * to values that could be assigned to a variable of type <code>T</code>.
+ *
* @param reason
* additional information about the error
* @param <T>

0 comments on commit 8c2f789

Please sign in to comment.
Something went wrong with that request. Please try again.