我正在尝试创建一个方法,该方法接收扩展 Component 的对象并将其插入到使用对象类作为对象本身的键的映射中。出于某种原因,它抱怨看跌期权
components = new Array<ObjectMap<Class,? extends Component>>();
public <T extends Component> void putComponentOnEntity(Entity e, T component) {
if (entities.items[e.id] == null) {
throw new IllegalArgumentException("Entity does not exist anymore");
}
ObjectMap<Class, ? extends Component> entityComponents = components.get(e.id);
entityComponents.put(component.getClass(), component);
}
--
The method put(Class, capture#4-of ? extends Component) in the type ObjectMap<Class,capture#4-of ? extends Component> is not applicable for the arguments (Class<capture#5-of ? extends Component>, T)