Skip to content

πŸ‘» Ghost Serializer β€” Release v1.2.4 (Hotfix)

Choose a tag to compare

@juanchurtado1991 juanchurtado1991 released this 01 Jul 00:08
· 445 commits to main since this release

We are releasing v1.2.4 as an urgent hotfix addressing critical compilation and runtime crashes when matching JSON field names. All users are strongly encouraged to upgrade immediately.

πŸš€ What's Fixed

Perfect Hash Collision Resolution in KSP & Runtime (Issue #10)

Previously in v1.2.3 and below, classes containing properties of the exact same character length that also shared overlapping prefixes/suffixes (e.g., modelCode vs modelName, dateCreated vs dateUpdated, or inviterUsername vs inviteeUsername) could trigger identical key hashes in the perfect hashing algorithm.
This resulted in:

  • Compile-time KSP failures due to the generator being unable to resolve a collision-free multiplier.
  • Runtime deserialization crashes (GhostJsonException: Expected '"') or silent data mapping corruption when fields resolved to the same slot during O(1) matching.
    How we fixed it:
    We refactored PerfectHashFinder (compiler) and JsonReaderOptions (runtime) to utilize a zero-allocation polynomial accumulation while loop (hash multiplier of 31) over all remaining bytes of the field name upon detecting a collision. This completely resolves collision overlapping, guaranteeing correct field dispatch with zero extra memory overhead.

πŸ“¦ Dependency Info

[versions]
ghost = "1.2.4"
ksp   = "2.1.10-1.0.31"
[libraries]
ghost-api           = { module = "com.ghostserializer:ghost-api", version.ref = "ghost" }
ghost-serialization = { module = "com.ghostserializer:ghost-serialization", version.ref = "ghost" }
ghost-compiler      = { module = "com.ghostserializer:ghost-compiler", version.ref = "ghost" }
plugins {
    id("com.google.devtools.ksp") version "2.1.10-1.0.31"
    id("com.ghostserializer.ghost") version "1.2.4"
}