我正在使用HashMap和下面显示的方法来跟踪类类型的更改侦听器。 IDE正在发出警告
[rawtypes] found raw type: java.lang.Class
missing type parameters for generic class java.lang.Class<T>.
需要指定哪种类型的类来解决警告?
private HashMap<Class, Set<ChangeListener>> classChangeListeners;
/**
* Adds a ChangeListener to the listener list for the specified class type. The class type
* specified must be a subclass of {@link BusinessObject}.
*
* @param <T> the type of BusinessObject.
* @param cls the class type.
* @param listener the ChangeListener to be added.
*/
public <T extends BusinessObject> void addChangeListener(Class<T> cls, ChangeListener listener)
{
if (!classChangeListeners.containsKey(cls))
{
classChangeListeners.put(cls, new TreeSet<ChangeListener>());
}
classChangeListeners.get(cls).add(listener);
}