Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionFactory should create empty EnumSets and EnumMaps [SPR-12533] #17138

Closed
2 tasks done
spring-projects-issues opened this issue Dec 10, 2014 · 1 comment
Closed
2 tasks done
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 10, 2014

Sam Brannen opened SPR-12533 and commented

Status Quo

#17089 introduced conversion support for EnumSet and EnumMap in CollectionFactory; however, the newly introduced support contradicts the existing contract for the related methods by creating a copy of the supplied set or map, thereby potentially including elements in the returned collection when the returned collection should in fact be empty.

Deliverables

  1. Refactor createApproximateCollection() so that it returns an empty EnumSet.
  2. Refactor createApproximateMap() so that it returns an empty EnumMap.

Affects: 4.1.3

Issue Links:

Referenced from: commits aec284a

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 10, 2014

Sam Brannen commented

Resolved as described in the comments for GitHub commit aec284a:

Create empty EnumSets & EnumMaps in CollectionFactory

#17089 introduced automatic type conversion support for EnumSet and
EnumMap. However, the corresponding changes in CollectionFactory
contradict the existing contract for the "create approximate" methods
by creating a copy of the supplied set or map, thereby potentially
including elements in the returned collection when the returned
collection should in fact be empty.

This commit addresses this issue by ensuring that the collections
returned by createApproximateCollection() and createApproximateMap()
are always empty.

Furthermore, this commit improves the Javadoc throughout the
CollectionFactory class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants