Skip to content

[CONFIGURATION-857] Preserve duplicate non-String scalar values in flatten()#645

Merged
garydgregory merged 7 commits into
apache:masterfrom
mgalbis:CONFIGURATION-857-duplicate-scalar-values
Jul 15, 2026
Merged

[CONFIGURATION-857] Preserve duplicate non-String scalar values in flatten()#645
garydgregory merged 7 commits into
apache:masterfrom
mgalbis:CONFIGURATION-857-duplicate-scalar-values

Conversation

@mgalbis

@mgalbis mgalbis commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes CONFIGURATION-857.

Preserves duplicate scalar values and changes cycle detection to track only containers in the current recursion path. This skips actual back-references while allowing unrelated repeated containers and nested copies to be flattened normally.

@garydgregory garydgregory changed the title CONFIGURATION-857: Preserve duplicate non-String scalar values in flatten() [CONFIGURATION-857] Preserve duplicate non-String scalar values in flatten() Jul 14, 2026
@garydgregory
garydgregory requested a review from Copilot July 14, 2026 16:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CONFIGURATION-857 by adjusting list-delimiter flattening so duplicate non-String scalar values are preserved and cycle detection only skips true back-references on the active recursion path, rather than globally de-duplicating.

Changes:

  • Updates AbstractListDelimiterHandler.flatten() to preserve duplicate non-String scalar values and to treat recursion tracking as path-scoped.
  • Extends regression coverage for typed getList(Class, key) conversions with duplicate values (including non-String scalars).
  • Updates compression/cycle regression tests to reflect the new (non-global) cycle detection behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/org/apache/commons/configuration2/convert/AbstractListDelimiterHandler.java Updates flattening and recursion/container detection behavior to preserve duplicates and adjust cycle detection.
src/test/java/org/apache/commons/configuration2/TestAbstractConfigurationBasicFeatures.java Adds a typed getList() regression test ensuring duplicates are preserved across multiple scalar types.
src/test/java/org/apache/commons/configuration2/TestPropertiesConfiguration.java Updates cycle/compression regression expectations to match the new recursion-path-based flatten semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@garydgregory garydgregory left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @mgalbis
Thank you for the PR. Please review the copilot comment and my comments as well.

@mgalbis
mgalbis requested a review from garydgregory July 14, 2026 22:56
@garydgregory
garydgregory merged commit d3a464c into apache:master Jul 15, 2026
8 of 9 checks passed
@garydgregory

Copy link
Copy Markdown
Member

Thank you @mgalbis , merged 🚀

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.

3 participants