Matchers.anyOf: inference variable has incompatible bounds with Java >8 · Issue #256 · hamcrest/JavaHamcrest

The following code sample works with OpenJDK 8 but does not compile with OpenJDK 11:

public class SimpleTest {
	@Test
	public void test() {
		List<String> list = new ArrayList<>();
		assertThat(list, anyOf(hasItem("a"), hasItem("b")));
	}
}

Compiling with Java 11 fails with

    [javac]     method Assert.<T#1>assertThat(String,T#1,Matcher<? super T#1>) is not applicable
    [javac]       (cannot infer type-variable(s) T#1
    [javac]         (actual and formal argument lists differ in length))
    [javac]     method Assert.<T#2>assertThat(T#2,Matcher<? super T#2>) is not applicable
    [javac]       (inference variable T#3 has incompatible bounds
    [javac]         lower bounds: String,Object
    [javac]         lower bounds: String,Object)
    [javac]   where T#1,T#2,T#3 are type-variables:
    [javac]     T#1 extends Object declared in method <T#1>assertThat(String,T#1,Matcher<? super T#1>)
    [javac]     T#2 extends Object declared in method <T#2>assertThat(T#2,Matcher<? super T#2>)
    [javac]     T#3 extends Object declared in method <T#3>hasItem(T#3)

If the first argument of the Matchers.anyOf methods would be changed from Matcher to Matcher<? super T> (like in Matchers.allOf), it would work.