Skip to content

Use depth-aware bracket parsing in PropertyAccessorUtils #36999

Closed

Description

@sbrannen

The canonicalPropertyName() method in PropertyAccessorUtils currently uses a simple indexOf("]") check to locate the end of a bracket key expression; whereas, getPropertyNameKeyEnd() in AbstractNestablePropertyAccessor tracks bracket nesting depth. This means the two methods can disagree on the canonical form of a property path whose map key itself contains bracket characters (e.g., map['key[0]']).

Although the use of map keys containing brackets is not documented as a supported use case, for consistency we should update canonicalPropertyName() to use depth-aware bracket parsing analogous to getPropertyNameKeyEnd(), so that the canonical form it produces is always consistent with how the property accessor resolves the same path.

Similarly, getNestedPropertySeparatorIndex() currently tracks whether a dot separator occurs inside a bracket key expression using a simple boolean toggle that flips on both [ and ]. This works correctly when a map key contains a balanced number of inner bracket pairs (since the extra toggles cancel out), but produces an incorrect result when the key contains an odd net count of inner bracket characters. To address that, we should update the method to track bracket nesting depth rather than using a boolean toggle, analogous to getPropertyNameKeyEnd().

NOTE: This issue is assigned and therefore not suitable for community contributions.

Activity

  1. added this to the 7.1.x milestone on Jul 2, 2026
  2. self-assigned this
    on Jul 2, 2026
  3. added
    in: coreIssues in core modules (aop, beans, core, context, expression)
    on Jul 2, 2026
  4. changed the title [-]Use depth-aware bracket parsing for canonical property names in `PropertyAccessorUtils`[/-] [+]Use depth-aware bracket parsing in `PropertyAccessorUtils`[/+] on Jul 2, 2026
  5. modified the milestones: 7.1.x, 7.1.0-M2 on Aug 26, 2026
  6. added 2 commits that reference this issue on Aug 28, 2026
    1b56f58
    1911647
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions