Repository navigation
Conversation
pjfanning
reviewed
Nov 23, 2026
pjfanning
left a comment
Member
There was a problem hiding this comment.
Two non-blocking notes:
XmlObject.valueEquals,compareValueandvalueHashCodechange for0/-0, so this deserves a line in the release notes.- I am not sure about the spec citation. From memory the wording on signed zero differs between the XML Schema 1.0 editions and 1.1 (I have not rechecked it), so it may be worth confirming the reference. Agreement with Xerces is the stronger argument for the change in any case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[xs:float] minInclusive 0, value -0
XMLBeans = INVALID: cvc-minInclusive-valid
Xerces = VALID
Found these in a differential run of XmlObject.validate() against the JDK Xerces validator over xs:float and xs:double: 14 disagreements, every one with -0 on a side.
They all come from JavaFloatHolder.compare, which drops through to a floatToIntBits tie-break once neither < nor > holds. floatToIntBits(-0.0f) is 0x80000000, so -0 sorts below 0 and never compares equal to it. JavaDoubleHolder.compare does the same with doubleToLongBits. The tie-break is there for NaN, which has to equal itself although NaN == NaN is false in Java; signed zero reaches it by accident. XML Schema Part 2 3.2.4 gives float the value space m x 2^e plus the three special values, so there is one zero and -0 and 0 are the same value.
Four observations. xs:unique and xs:key miss a duplicate pair 0 / -0, because IdentityConstraint keys field values on valueEquals and valueHashCode. xs:keyref rejects a reference written -0 against a key written 0. minInclusive='0' rejects -0 and maxInclusive='-0' rejects 0, while minExclusive='-0' accepts 0, and enumeration value='0' does not match -0. XmlObject.valueEquals, compareValue and valueHashCode disagree with the value space.
Both compare methods now return 0 when the two values are IEEE-equal, ahead of the bit tie-break, and value_hash_code maps -0 onto 0 so valueEquals and valueHashCode stay in step. NaN keeps the tie-break, so it still equals itself and nothing else. Every other value behaves as before, and all 14 cases agree with Xerces after the change. Regression test added.