I'm working on a java project, this is my code:
Class<? extends Component> componentClass = componentField.getType();
Component tempComponent = entity.get(componentClass);
This is my error:
incompatible types: Class<CAP#1> cannot be converted to Class<? extends Component> where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
componentField is a field from which I know that it extends Component, when I try to get the type it returns me a fresh-type CAP#1, is it possible to cast it to a class extending from component? the entity.get() is a generic method that takes a <T extends Component>
as argument.
Aucun commentaire:
Enregistrer un commentaire