class Test { public void doesNotCompile() { Container container = new Container(); assertThat(container, hasSomething(is("foo"))); } public static class Container {} public static Matcher> hasSomething(Matcher matcher) { return null; } public static void assertThat(T actual, Matcher matcher) {} public static Matcher is(T value) { return null; } public interface Matcher {} }