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

Change MultiValueMap to extend Map<K, List<? extends V>> #24840

Closed
jonfreedman opened this issue Apr 1, 2020 · 2 comments
Closed

Change MultiValueMap to extend Map<K, List<? extends V>> #24840

jonfreedman opened this issue Apr 1, 2020 · 2 comments
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply

Comments

@jonfreedman
Copy link

If we change MultiValueMap to wildcard the List type it extends then this code will compile

final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<>();
final  List<String> enumFormStringArray = Collections.singletonList("foo");
formParams.put("enum_form_string_array", enumFormStringArray);

This will allow us to clear up some warnings in the openapi-generator (OpenAPITools/openapi-generator#5782)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 1, 2020
@jonfreedman
Copy link
Author

I had a look at this change, it seems to me that the #addAll method was added to solve this, although the semantics are slightly different. I think what really should happen is that this interface should not extend Map at all, similar to the Multimap interface in Guava.

@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 12, 2021
@snicoll
Copy link
Member

snicoll commented Sep 28, 2023

Thanks for the suggestion but we'd like to retain the same contract as what java.util.Map does.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 28, 2023
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) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

4 participants