mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Consistent support for EnumSet subclasses in CollectionFactory
Issue: SPR-17619
(cherry picked from commit 31a24720a6)
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.
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user