INT-3218 Spring 4 Compatibility
Use `Arrays.asList()` instead of `Collections.arrayToList()` in places where a generic type needs to be supplied by the caller. This maintains compile-time compatibility with both Spring 3 and 4, where Spring 4 added the generic type to the utility class. The four occurrences where this was needed are not impacted by the fact that `Arrays.asList()` returns an unmodifiable list.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.integration.ip.tcp.connection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -44,14 +45,14 @@ public class TcpConnectionEventListeningMessageProducer extends MessageProducerS
|
||||
* this adapter should send to the message channel. By default, all event
|
||||
* types will be sent.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setEventTypes(Class<? extends TcpConnectionEvent>[] eventTypes) {
|
||||
Assert.notEmpty(eventTypes, "at least one event type is required");
|
||||
Set<Class<? extends TcpConnectionEvent>> eventTypeSet = new HashSet<Class<? extends TcpConnectionEvent>>();
|
||||
eventTypeSet.addAll(CollectionUtils.arrayToList(eventTypes));
|
||||
eventTypeSet.addAll(Arrays.asList(eventTypes));
|
||||
this.eventTypes = eventTypeSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(TcpConnectionEvent event) {
|
||||
if (this.isRunning()) {
|
||||
if (CollectionUtils.isEmpty(this.eventTypes)) {
|
||||
|
||||
Reference in New Issue
Block a user