Consistent support for EnumSet subclasses in CollectionFactory
Issue: SPR-17619
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -195,7 +195,7 @@ public final class CollectionFactory {
|
||||
throw new IllegalArgumentException("Unsupported Collection interface: " + collectionType.getName());
|
||||
}
|
||||
}
|
||||
else if (EnumSet.class == collectionType) {
|
||||
else if (EnumSet.class.isAssignableFrom(collectionType)) {
|
||||
Assert.notNull(elementType, "Cannot create EnumSet for unknown element type");
|
||||
// Cast is necessary for compilation in Eclipse 4.4.1.
|
||||
return (Collection<E>) EnumSet.noneOf(asEnumType(elementType));
|
||||
|
||||
Reference in New Issue
Block a user