I’ve played around, and for example I can make the method declaration T: Class<out X>, but that then gives an error because of the return type of the method, “found: org.hamcrest.Matcher<java.lang.Integer>, required: org.hamcrest.Matcher<? super java.lang.Object>"