I use a method from a third-party library ( Reflections ), which should find subtypes of this type and looks like
public <T> Set<Class<? extends T>> getSubTypesOf(final Class<T> type) {
...
When the caller code looks like
Class<?> type = ...
Set<Class<?>> subTypes = reflections.getSubTypesOf(type);
I get a compilation error: " cannot convert from Set<Class<? extends capture#19-of ?>> to Set<Class<?>>". The following is the situation:
Class<?> type = ...
Set<?> subTypes = reflections.getSubTypesOf(ht);
therefore, it seems that the only possible remedy for the wrong Set<Class<? extends ?>>will be Set<?>, but not Set<Class<?>>. Why is this so? Thanks for any explanation on this.
source
share