Skip to content

Let valueEquals match a copy() against its original - #130

Merged
pjfanning merged 1 commit into
apache:trunkfrom
pjfanning:value-equals-copy
Oct 4, 2026
Merged

pjfanning merged 1 commit into
apache:trunkfrom
pjfanning:value-equals-copy

Conversation

@pjfanning

Copy link
Copy Markdown
Member

Follow-up to #106 (XMLBEANS-658).

XmlValueComparison.content_equal walks both trees until their content runs out. A value made by copy() is rooted at a document, so its walk ends on ENDDOC. An element inside a document ends on END. Because the two tokens differ, x.copy().valueEquals(x) returned false for every complex value.

The fix treats either finish token as the end of the content.

POI's TestXWPFNumbering.testCompareAbstractNum failed on 5.5.0-SNAPSHOT because of this: XWPFNumbering.getIdOfAbstractNum compares a copied CTAbstractNum against the numbering's own.

  • New ValueEqualsTest.testCopyEqualsOriginal fails without the fix and passes with it
  • Full ./gradlew test passes

🤖 Generated with Claude Code

complex_values_equal walks both trees until their content runs out. A
value made by copy() is rooted at a document, so its walk ends on ENDDOC,
while an element in a document ends on END. The two tokens differ, so
x.copy().valueEquals(x) was false for every complex value.

Treat either finish token as the end of the content.

Found by POI's TestXWPFNumbering.testCompareAbstractNum, which matches a
copied CTAbstractNum against the numbering's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pjfanning
pjfanning merged commit b922105 into apache:trunk Oct 4, 2026
3 checks passed
@pjfanning
pjfanning deleted the value-equals-copy branch October 4, 2026 15:56
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.

1 participant