Consistent support for EnumSet subclasses in CollectionFactory

Issue: SPR-17619

(cherry picked from commit 31a24720a6)
This commit is contained in:
Juergen Hoeller
2018-12-25 13:20:31 +01:00
parent 3c7887c2ae
commit 21baa7287b
2 changed files with 21 additions and 13 deletions
@@ -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.
@@ -189,7 +189,7 @@ public abstract 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));