Is it possible to resolve the problem with weak inference without defining additional variables or type casts for code below?
public class GenericClass<T> {
public <R> R m(Class<R> cl) {
return null;
}
}
GenericClass<SomeClass> v2 = new GenericClass<SomeClass>()
.m(GenericClass.class)
.m(GenericClass.class); // <- Object cannot be converted to GenericClass<SomeClass>