This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch docs
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/docs by this push:
new e6657bb6c6 Document Version strict-equality breaking change:
equals/hashCode/compareTo are now exact; prefix-matching moved to matches().
e6657bb6c6 is described below
commit e6657bb6c68ddbabf351608f2260e7d70576184e
Author: James Bognar <[email protected]>
AuthorDate: Fri Jul 17 12:57:12 2026 -0400
Document Version strict-equality breaking change: equals/hashCode/compareTo
are now exact; prefix-matching moved to matches().
Co-authored-by: Cursor <[email protected]>
---
pages/release-notes/10.0.0.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pages/release-notes/10.0.0.md b/pages/release-notes/10.0.0.md
index a24c6b2dc6..5758f85b4f 100644
--- a/pages/release-notes/10.0.0.md
+++ b/pages/release-notes/10.0.0.md
@@ -714,6 +714,12 @@ _TBD — to be filled in as development continues._
- **Session property keys removed:** the `"fileCharset"` (and qualified
`"WriterSerializerSession.fileCharset"` / `"ReaderParserSession.fileCharset"`)
session `property(...)` keys are no longer recognized.
- **Migration:** none needed for correctness — the setting had no effect
after TODO-248. Remove any lingering `.fileCharset(...)` builder calls or
`@SerializerConfig`/`@ParserConfig` `fileCharset` attributes. If you relied on
`File`-charset behavior, decode the `Reader`/`InputStream` yourself before
passing it in (see the `File` migration snippet above).
+- **`Version.equals()` / `hashCode()` / `compareTo()` are now strict (exact);
prefix matching moved to `Version.matches(Version)`.**
`org.apache.juneau.commons.lang.Version` previously used **prefix-tolerant**
equality — a shorter version was considered equal to any longer version sharing
its prefix (`Version.of("1.2").equals(Version.of("1.2.3"))` → `true`), while
`hashCode()` (`Arrays.hashCode(parts)`) and `compareTo(...)` were
length-sensitive. That combination **violated the `equals`/ [...]
+ - **`equals(Object)` is now exact** — two versions are equal only when their
full component sequences are identical, so `Version.of("1.2")`,
`Version.of("1.2.0")`, and `Version.of("1.2.3")` are now all **unequal**.
`hashCode()` (unchanged, `Arrays.hashCode(parts)`) and `compareTo(...)`
(unchanged, already strict) are now mutually consistent with `equals`.
+ - **The removed `boolean equals(Version)` overload's prefix semantics live
on as a new `boolean matches(Version)` method** —
`Version.of("1.2").matches(Version.of("1.2.3"))` → `true`. Use `matches(...)`
wherever you previously relied on prefix/compatibility comparison. Note that
`matches(...)` is intentionally **not** consistent with `hashCode()` and must
never be used for hash-/tree-based collection membership.
+ - **Unaffected:** `isAtLeast(...)` / `isAtMost(...)` (and therefore
`VersionRange`, client-version negotiation, and the `FluentVersionAssertion`
comparison methods, which use `compareTo`) are unchanged.
+ - **Migration:** replace any `v1.equals(v2)` call on two `Version` values
that depended on prefix matching with `v1.matches(v2)`. Exact equality
(`assertEquals`, `Set`/`Map` keys) now behaves per the corrected contract with
no code change.
+
_Other entries TBD — to be filled in before release. See also the major
version bump note above._
### Deprecations