I have a function B that has this declaration:
public void B(Class<? extends C> clazz);
I have a class A and a class C that look like this:
public interface C {}
public class A implements C{}
I would like to do this:
B(A.class);
However Java is wanting me do to this (and then complains about unchecked casts)
B( (Class<? extends C>)A.class );
How do I indicate to Java that this is all type-safe?
Works for me:
Perhaps you could post a short but complete example of what’s failing?