Skip to content

Serialize via the shared pure-Kotlin SerializationCodec (no JNI)#496

Open
milyin wants to merge 6 commits into
zenoh-flat-transitionfrom
pure-kotlin-serde
Open

Serialize via the shared pure-Kotlin SerializationCodec (no JNI)#496
milyin wants to merge 6 commits into
zenoh-flat-transitionfrom
pure-kotlin-serde

Conversation

@milyin

@milyin milyin commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What

Replaces the per-element JNI serialization (serializeViaJNI) with the shared pure-Kotlin SerializationCodec (zenoh-flat-jni#13) — the same codec zenoh-kotlin uses (no duplication).

ZSerializer/ZDeserializer build a SerializationCodec.SerdeType from the Guava TypeToken's java.lang.reflect.Type (serdeTypeOfJava) and call the shared codec through the same throwZError0 handler used for generated wrappers (the codec never throws — it invokes the handler, which throws ZError), so the hand-written serializer is wired exactly like a generated one.

Verification

Full jvmTest: 120 pass (the 10 ZBytes tests now run via pure Kotlin). The Type path's supported set is unchanged (signed/collection; Java can't express the unsigned/Pair/Triple types the Kotlin KType path adds).

Notes

  • No separate Phase-1 (KType JNI) change was needed on zenoh-java — its Type path was untouched there — so this branches off split-error-handler directly. Depends on zenoh-flat-jni#13; CI pin bumped to its commit.
  • The Rust serializer is kept temporarily as the correspondence oracle/baseline (a follow-up removes it).

🤖 Generated with Claude Code

milyin and others added 2 commits July 21, 2026 16:53
Replace the per-element JNI serialization (serializeViaJNI) with the shared
pure-Kotlin SerializationCodec. ZSerializer/ZDeserializer build a
SerializationCodec.SerdeType from the Guava TypeToken's java.lang.reflect.Type
(serdeTypeOfJava) and call the shared codec through the SAME throwZError0 error
handler used for generated wrappers (the codec never throws — it invokes the
handler, which throws ZError), so the hand-written serializer is wired exactly
like a generated one. No duplication — the same codec zenoh-kotlin uses.

Full jvmTest: 120 pass (the 10 ZBytes tests now run via pure Kotlin). The Type
path's supported set is unchanged (signed/collection; Java can't express the
unsigned/Pair/Triple types the KType path adds).

Depends on the zenoh-flat-jni SerializationCodec commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The pure-Kotlin SerializationCodec this branch delegates to lives in
zenoh-flat-jni#13 (db4fb2d). Point CI at it so the composite build has the
shared codec.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@milyin
milyin force-pushed the pure-kotlin-serde branch from 77690ae to ce7f32a Compare July 21, 2026 14:53
@milyin
milyin changed the base branch from split-error-handler to zenoh-flat-transition July 21, 2026 14:53
milyin and others added 4 commits July 21, 2026 18:00
The zenoh-flat-jni serialization PR was rebased onto main (conflict resolution),
changing the SerializationCodec commit SHA. Repoint CI at the current commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Parameters/Encoding/ZenohId correspondence tests moved into zenoh-flat-jni's
own test suite (it now self-verifies its pure implementations against the native
oracle, which relocated to the internal io.zenoh.jni.test package). SDK
production is unaffected — it uses the pure io.zenoh.jni.query.Parameters and the
generated Encoding/ZenohId handles, all unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
zenoh-flat-jni moved its native oracle to the internal io.zenoh.jni.test
package and added self-verifying correspondence tests. Point CI at that commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
zenoh-flat-jni #13 squash-merged to main as 71736f2. Re-pin from the
pre-merge branch commit 2755c06 (an orphan once the pure-kotlin-serde
branch is deleted) to the permanent main commit, which also carries the
final merged SerializationCodec (strict UTF-8).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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