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

Property binding to Map that implements Iterable no longer works #34332

Closed
fournm opened this issue Jan 28, 2025 · 1 comment
Closed

Property binding to Map that implements Iterable no longer works #34332

fournm opened this issue Jan 28, 2025 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: regression A bug that is also a regression
Milestone

Comments

@fournm
Copy link

fournm commented Jan 28, 2025

Overview

The initial PR (#907) implemented the following ordering in AbstractNestablePropertyAccessor, supported by tests:

  • List
  • Map
  • Iterable

The version that was finally added in c20a2e4 implements the following ordering:

  • List
  • Iterable (replacing Set)
  • Map

This causes any Map that implements Iterable to fail binding in Spring 6.1+, where they functioned previously.

It seems less likely that iterables will implement Map in a broken fashion, as opposed to the other way around.

Related Issues

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 28, 2025
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Jan 29, 2025
@sbrannen
Copy link
Member

sbrannen commented Jan 29, 2025

Hi @fournm,

Congratulations on submitting your first GitHub issue ever! 👍

This causes any maps that implement Iterable to fail binding in Spring 6.1+, where they functioned previously. It seems less likely that iterables will implement map in a broken fashion than the other way around.

Do you have a concrete use case with a Map that implements Iterable that demonstrates this issue?

In any case, we'll fix this regression and backport it to 6.1.x.

@sbrannen sbrannen added the status: waiting-for-feedback We need additional information before we can continue label Jan 29, 2025
@sbrannen sbrannen self-assigned this Jan 29, 2025
@sbrannen sbrannen added type: regression A bug that is also a regression and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 29, 2025
@sbrannen sbrannen added this to the 6.2.3 milestone Jan 29, 2025
@sbrannen sbrannen added the for: backport-to-6.1.x Marks an issue as a candidate for backport to 6.1.x label Jan 29, 2025
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.1.x Marks an issue as a candidate for backport to 6.1.x labels Jan 29, 2025
@sbrannen sbrannen changed the title Binding issue in AbstractNestablePropertyAccessor Binding to Map that implements Iterable no longer works Jan 29, 2025
@sbrannen sbrannen changed the title Binding to Map that implements Iterable no longer works Property binding to Map that implements Iterable no longer works Jan 29, 2025
sbrannen added a commit that referenced this issue Jan 29, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
The changes in commit c20a2e4 introduced a regression with regard to
binding to a Map property when the Map also happens to implement
Iterable.

Although that is perhaps not a very common scenario, this commit
reorders the if-blocks in AbstractNestablePropertyAccessor's
getPropertyValue(PropertyTokenHolder) method so that a Map is
considered before an Iterable, thereby allowing an Iterable-Map to be
accessed as a Map.

See gh-907
Closes gh-34332

(cherry picked from commit b9e43d0)
sbrannen added a commit that referenced this issue Jan 29, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
See gh-34332
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: backported An issue that has been backported to maintenance branches type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

3 participants