I have an interface as follows:
public interface ImportedEntity<T extends ImportedEntity<T, E>, E extends Enum<E>>
I want a class with an upperbound of that interface:
Class<ImportedEntity<?, ?>> c = ImportedEntity.class;
Class<ImportedEntity<?, ?>> c = ImportedEntitySubclass.class;
These obviously doesn’t compile because of the wildcard, but in terms of what I should be putting instead of the wildcards in order to get it to compile, my head is about to explode.
Worst comes to the worst I can use raw types, but I get the feeling if I do that I will have gone wrong somewhere.
You can add an unchecked cast on the right hand side like this:
I am afraid that somewhere you will have to make the unchecked cast and live with the warning, since the
classproperty cannot hold the type information.