Skip to content

Fix order-dependent resolution of cross-referencing properties#437

Merged
rgoers merged 1 commit into
trunkfrom
fix/map-resolver
May 29, 2026
Merged

Fix order-dependent resolution of cross-referencing properties#437
rgoers merged 1 commit into
trunkfrom
fix/map-resolver

Conversation

@ppkarwasz
Copy link
Copy Markdown
Member

When properties are defined in terms of each other, e.g. a = ${b} with b = OK, MapResolver#resolveProperties filled the result map while using that same map as the lookup source, so a reference only resolved when the referenced property had already been evaluated. As the iteration order of Properties#stringPropertyNames is unspecified, properties like a were sometimes left unresolved.

Pre-seed the map with the raw values so that every key is visible to the lookup regardless of evaluation order.

TestMapResolver covers both reference orderings, and documents that self-referencing and cyclic definitions are left to Commons Text's recursion guard, which either returns the literal or throws IllegalStateException.

When properties are defined in terms of each other, e.g. `a = ${b}` with `b = OK`, `MapResolver#resolveProperties` filled the result map while using that same map as the lookup source, so a reference only resolved when the referenced property had already been evaluated. As the iteration order of `Properties#stringPropertyNames` is unspecified, properties like `a` were sometimes left unresolved.

Pre-seed the map with the raw values so that every key is visible to the lookup regardless of evaluation order.

`TestMapResolver` covers both reference orderings, and documents that self-referencing and cyclic definitions are left to Commons Text's recursion guard, which either returns the literal or throws `IllegalStateException`.
@rgoers rgoers merged commit c9c55f3 into trunk May 29, 2026
4 checks passed
@rgoers rgoers deleted the fix/map-resolver branch May 29, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants