Use receiver-style zenoh-flat-jni bindings#481
Merged
Conversation
BFS from each required-but-unresolved type through struct fields, enum variants, generic args, and impl Fn args, surfacing transitively unresolved entries that propagate_required cannot reach (because subs edges don't exist past an unresolved parent). Without this, a missing declaration in build.rs for a type only referenced as a field of another unresolved struct went unreported. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
.method() is a namespace declaration — every #[prebindgen] fn must be assigned to a typed handle, data class, enum, or kotlin_package. There is no third "orphan" bucket, so JNIOrphaned was always emitted empty and the duplicate declared_function_names helper just repeated the PrebindgenExt::declared_functions trait method. - delete write_jni_orphaned, jni_orphaned_class_name, the stale generated JNIOrphaned.kt file - rename render_jni_orphaned_source -> render_jni_package_source, drop the now-redundant include_only_promoted / wrap_in_object / declared / class_name params - drop declared_function_names; render_jni_native_source now takes &HashSet<syn::Ident> from declared_functions() directly Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace the five scattered self.qualify_emitted_type() calls (build_input_fn, build_output_fn, opaque_handle_input, build_handle_destructor_items, option_input) with a single AST visitor pass applied once at write time. The previous design qualified only at specific emit sites — each new emit site had to remember the call. emit_into_dispatcher missed it, so the impl-Into dispatcher body emitted bare KeyExpr/ZKeyExpr references that failed to resolve in the binding crate's scope. Architecture: - New PrebindgenExt::post_process_item(item: &mut syn::Item) trait hook (default no-op), invoked by write_rust on every emitted item. - JniExt implements it via qualify_item, which runs QualifyEmittedTypes — a syn::visit_mut::VisitMut that walks the full AST (signatures, generic args, type ascriptions in let bindings, *mut/*const in cast expressions) and prefixes every bare single-segment Type::Path matching a registered source-module name with source_module. - option_input no longer takes &JniExt; the body uses the bare t1 token and the post-emit visitor qualifies it later. Also fixes the pre-existing TypeEntry field-name drift in final_invariant_reports_unresolved_field_of_unresolved_struct. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…pendency
- Remove :zenoh-flat-jni from gradle subprojects (moved to separate repo)
- Replace local source dependency with Maven: org.eclipse.zenoh:zenoh-flat-jni:1.9.0
- Remove Cargo build orchestration (buildZenohFlatJni, buildZenohFlatJNI, BuildMode)
- Remove build paths for zenoh-flat-jni libraries (now bundled in Maven JAR)
- Remove Cargo-related Gradle plugins and tasks
- Native libraries are now obtained from the zenoh-flat-jni Maven artifact
- Kotlin sources are now imported from the Maven JAR as a dependency
- Supports optional local development via: includeBuild("../zenoh-flat-jni")
- Simplifies zenoh-java build: Gradle now only compiles Kotlin, not Rust
Migration notes:
- zenoh-flat-jni is now at https://github.com/ZettaScaleLabs/zenoh-flat-jni
- Versions will be synchronized with Zenoh releases (1.9.0, etc.)
- For local development, clone both repos and use composite builds if needed
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ment - Uncomment includeBuild for ../zenoh-flat-jni since it's now in the PREBINDGEN workspace - zenoh-flat-jni is at /Users/milyin/PREBINDGEN/zenoh-flat-jni - Gradle will prefer local build over Maven artifact when composite build is enabled - Allows coordinated development of zenoh-java and zenoh-flat-jni Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The zenoh-flat-jni project has been moved to: - GitHub: https://github.com/ZettaScaleLabs/zenoh-flat-jni - Local workspace: /Users/milyin/PREBINDGEN/zenoh-flat-jni zenoh-java now consumes zenoh-flat-jni via: 1. Maven artifact (org.eclipse.zenoh:zenoh-flat-jni:1.9.0) in production 2. Gradle composite build (../zenoh-flat-jni) for local development Removing the local copy avoids duplication and confusion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Linked generator inputs: ZettaScaleLabs/zenoh-flat#1 and ZettaScaleLabs/zenoh-flat-jni#2. |
This was referenced Jul 15, 2026
# Conflicts: # zenoh-jni/Cargo.lock
zenoh-flat's consolidated API dropped the Z prefix from its Rust types (ZSample -> Sample, ...), and the generated callback interface names follow the type name mechanically: ZSampleCallback -> SampleCallback etc. Rename the four callback references in FlatCallbacks.kt (signatures are unchanged) and follow the encoding id accessor rename (id -> getId). Pin CI to the updated zenoh-flat-jni (receiver-style bindings regenerated against prebindgen main and zenoh-flat main) and to zenoh-flat main. Verified locally: jvmTest 101 tests, 0 failures against the composite build.
Contributor
Author
|
Updated to the consolidated upstream stack (commit 8461c29):
Validation: composite build compiles; |
zenoh-flat-jni now derives all regular method names from the flat crate's identifiers (explicit .name() only where a clash forces it), so the internal calls follow: JniKeyExpr.newTryFrom/newAutocanonize/newJoin/newConcat, JniConfig.newFrom*, JniEncoding.newFromString/newWithSchema, JniZBytes.newFromVec, zSession.getPeersZid/getRoutersZid. SDK public API unchanged. CI pin bumped to the matching zenoh-flat-jni commit.
2 tasks
Contributor
Author
|
Retargeted to the |
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.
Summary
Throughput
Release benchmark, subscriber median msg/s across three passes, 8 rounds × 100,000 messages per point:
Baseline: upstream 20622e3. Benchmarked implementation: 834a51c. The later receiver-method update relocates the same generated wrapper bodies and native calls; it does not add work to the hot path.
Validation
Validated locally against prebindgen 616f676 and zenoh-flat-jni d8613fb:
Depends on:
CI intentionally resolves prebindgen from GitHub main, so the dependency chain must merge in order. This is the coordinated successor to #473.