Skip to content

4.101.0

Choose a tag to compare

@jdereg jdereg released this 19 Apr 22:19
· 80 commits to master since this release

java-util 4.101.0

Maven Central: com.cedarsoftware:java-util:4.101.0

Highlights

New APIs

  • ClassValueMap.getByClass(Class) — typed fast-path lookup that skips the instanceof Class guard in get(Object), compiling to a near-direct ClassValue.get(type) call. Converted 30+ hot-path call sites across ClassUtilities, Converter.ClassPairMap, MultiKeyMap, TypeUtilities, Unsafe, CompactMap, and CollectionHandling.
  • ClassValueSet.containsClass(Class) — parallel typed fast path on the Set side. Skips the null check and instanceof Class guard in contains(Object). Converted 9 hot-path call sites in MultiKeyMap (flatten/hash/equals paths) and ClassUtilities.SECURITY_CHECK_CACHE.
  • ReflectionUtils.getDirectClassAnnotation(Class, Class) — strict JDK-semantics companion to getClassAnnotation. Matches Class.getAnnotation(Class) exactly (respects @Inherited, never walks interfaces), for identity-tied annotations like @Entity, @JsonNaming, @IoNaming.
  • StringUtilities.getChars(String, int) + getChars(String) — SIMD bulk-copy helpers for hot-path charAt-loop replacements.

Performance

  • Converter — refactored 4 internal caches (CONVERSION_DB, FULL_CONVERSION_CACHE, USER_DB, cacheInheritancePairs) from Map<ConversionPair, V> to nested ClassValueMap<ClassValueMap<V>>, eliminating per-lookup ConversionPair allocation from every convert() call. ConversionPair is gone from the JFR hot-path allocation top-5.
  • Converter.USER_DB — dropped redundant instanceId from cache keys (legacy from an earlier static design).
  • FastReader.readUntil / readLine — 30% reduction in GETFIELD field accesses on the common path (scan-loop local hoisting, elided unconditional PUTFIELD writes, refill moved to loop top).
  • FastReader.readLine(char[], int, int) — ~22% self-time reduction via explicit CSE hoisting of b[scanPos].
  • StringUtilities — SIMD-intrinsic String.getChars() bulk-copy pattern applied to levenshteinDistance, damerauLevenshteinDistance, and decode(String) (hex). Loop-invariant chars hoisted out of the Levenshtein inner loops.

Correctness

  • ClassValueMap — marked cachedEntrySet, cachedValues, cachedUnmodifiableView volatile to close a latent DCL publication race.
  • ReflectionUtils.getAllConstructorsInternal() — added deterministic tie-breaker to constructor sort (fixes ~30% intermittent failure rate in ClassUtilitiesVarargsArrayStoreTest under JaCoCo).

Security

  • ReflectionUtils.isTrustedCaller() — stack walk no longer misidentifies java-util's own internal cache infrastructure as a trusted caller. Previous prefix-match allowed external callers to bypass dangerous-class blocking on paths routed through cache-populating lambdas.

Build

  • JaCoCo code coverage plugin wired in permanently. Reports auto-generated on every mvn test at target/site/jacoco/.

Testing

  • 19,964 tests total — +380 new coverage tests across EncryptionUtilities, ReflectionUtils, UrlUtilities, IOUtilities, DeepEquals, MultiKeyMap, ClassUtilities, plus new ClassValueMapTest and ClassValueSetTest entries for the typed fast paths.

Full changelog: https://github.com/jdereg/java-util/blob/master/changelog.md