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

Support for SequencedCollection/Set/Map #30239

Closed
jhoeller opened this issue Mar 30, 2023 · 1 comment
Closed

Support for SequencedCollection/Set/Map #30239

jhoeller opened this issue Mar 30, 2023 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

jhoeller commented Mar 30, 2023

JDK 21 comes with new SequencedCollection/SequencedSet/SequencedMap types, with SequencedCollection as super-interface of List and Deque, and the other implemented by LinkedHashSet/LinkedHashMap. While we won't be able to benefit from the new hierarchy and its new operations in the framework codebase yet, we should provide everything we can for application usage: e.g. detection in CollectionFactory and support for the new operations in our org.springframework.util List implementations.

@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Mar 30, 2023
@jhoeller jhoeller added this to the 6.1.0-M1 milestone Mar 30, 2023
@jhoeller jhoeller self-assigned this Mar 30, 2023
@jhoeller
Copy link
Contributor Author

jhoeller commented May 3, 2023

CollectionFactory supports user declarations of type SequencedCollection/SequencedSet/SequencedMap now, e.g. for injection points.

AutoPopulatingList inherits all SequencedCollection default methods as declared in the List interface, automatically supporting them on JDK 21 in a good enough fashion.

For the time being, LinkedCaseInsensitiveMap and LinkedMultiValueMap do not implement any SequencedMap operations since they would have to explicitly implement that interface rather than inherit its declaration. None of those operations seem to matter for the common usage of those classes. If necessary, we can revisit this with extended JDK 21 implementations of LinkedCaseInsensitiveMap/LinkedMultiValueMap declaring implements SequencedMap in our new spring-core multi-release jar, with the primary feature of a reversed Map view having to be provided (and maintained) then.

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: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant