HHH-7030 - EventListenerRegistry interface generic declaration is not extensible to subclasses
This commit is contained in:
parent
4595df2395
commit
79774a0453
|
@ -115,12 +115,12 @@ public class EventListenerRegistryImpl implements EventListenerRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void setListeners(EventType<T> type, Class<T>... listenerClasses) {
|
public <T> void setListeners(EventType<T> type, Class<? extends T>... listenerClasses) {
|
||||||
setListeners( type, resolveListenerInstances( type, listenerClasses ) );
|
setListeners( type, resolveListenerInstances( type, listenerClasses ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings( {"unchecked"})
|
@SuppressWarnings( {"unchecked"})
|
||||||
private <T> T[] resolveListenerInstances(EventType<T> type, Class<T>... listenerClasses) {
|
private <T> T[] resolveListenerInstances(EventType<T> type, Class<? extends T>... listenerClasses) {
|
||||||
T[] listeners = (T[]) Array.newInstance( type.baseListenerInterface(), listenerClasses.length );
|
T[] listeners = (T[]) Array.newInstance( type.baseListenerInterface(), listenerClasses.length );
|
||||||
for ( int i = 0; i < listenerClasses.length; i++ ) {
|
for ( int i = 0; i < listenerClasses.length; i++ ) {
|
||||||
listeners[i] = resolveListenerInstance( listenerClasses[i] );
|
listeners[i] = resolveListenerInstance( listenerClasses[i] );
|
||||||
|
@ -162,7 +162,7 @@ public class EventListenerRegistryImpl implements EventListenerRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void appendListeners(EventType<T> type, Class<T>... listenerClasses) {
|
public <T> void appendListeners(EventType<T> type, Class<? extends T>... listenerClasses) {
|
||||||
appendListeners( type, resolveListenerInstances( type, listenerClasses ) );
|
appendListeners( type, resolveListenerInstances( type, listenerClasses ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public class EventListenerRegistryImpl implements EventListenerRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void prependListeners(EventType<T> type, Class<T>... listenerClasses) {
|
public <T> void prependListeners(EventType<T> type, Class<? extends T>... listenerClasses) {
|
||||||
prependListeners( type, resolveListenerInstances( type, listenerClasses ) );
|
prependListeners( type, resolveListenerInstances( type, listenerClasses ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,12 @@ public interface EventListenerRegistry extends Service, Serializable {
|
||||||
|
|
||||||
public void addDuplicationStrategy(DuplicationStrategy strategy);
|
public void addDuplicationStrategy(DuplicationStrategy strategy);
|
||||||
|
|
||||||
public <T> void setListeners(EventType<T> type, Class<T>... listeners);
|
public <T> void setListeners(EventType<T> type, Class<? extends T>... listeners);
|
||||||
public <T> void setListeners(EventType<T> type, T... listeners);
|
public <T> void setListeners(EventType<T> type, T... listeners);
|
||||||
|
|
||||||
public <T> void appendListeners(EventType<T> type, Class<T>... listeners);
|
public <T> void appendListeners(EventType<T> type, Class<? extends T>... listeners);
|
||||||
public <T> void appendListeners(EventType<T> type, T... listeners);
|
public <T> void appendListeners(EventType<T> type, T... listeners);
|
||||||
|
|
||||||
public <T> void prependListeners(EventType<T> type, Class<T>... listeners);
|
public <T> void prependListeners(EventType<T> type, Class<? extends T>... listeners);
|
||||||
public <T> void prependListeners(EventType<T> type, T... listeners);
|
public <T> void prependListeners(EventType<T> type, T... listeners);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue