Skip to content

Commit 69f7661

Browse files
committed
keyexpr type fix
1 parent 7c7bc04 commit 69f7661

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

zenoh-jni-runtime/src/commonMain/kotlin/io/zenoh/jni/JNISession.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class JNISession(internal val sessionPtr: Long) {
9696
fun declareKeyExpr(keyExpr: String): JNIKeyExpr = JNIKeyExpr(declareKeyExprViaJNI(sessionPtr, keyExpr), keyExpr)
9797

9898
@Throws(ZError::class)
99-
fun undeclareKeyExpr(jniKeyExpr: JNIKeyExpr) = undeclareKeyExprViaJNI(sessionPtr, jniKeyExpr.ptr)
99+
fun undeclareKeyExpr(jniKeyExpr: JNIKeyExpr) = undeclareKeyExprViaJNI(sessionPtr, jniKeyExpr)
100100

101101
@Throws(ZError::class)
102102
fun get(

zenoh-jni/build.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use itertools::Itertools;
2-
use quote::quote;
32
use zenoh_flat::jni_converter::{
43
InlineFn, JniMethodsConverter, JniStructConverter, TypeBinding,
54
};
@@ -87,15 +86,13 @@ fn shared_bindings() -> JniTypeBinding {
8786
"jni::sys::jint",
8887
InlineFn::pure("crate::utils::decode_reply_key_expr"),
8988
))
90-
// KeyExpr by-value: JNI side passes `Arc::into_raw(Arc::new(KeyExpr))`
91-
// as a raw pointer; the wrapper reconstructs the Arc, clones the inner
92-
// KeyExpr, and drops the Arc at end of scope. The full path is required
93-
// so the generated `*const T` parameter type resolves at the include site.
89+
// KeyExpr by-value: JNI side passes the JNIKeyExpr holder object
90+
// (`ptr: Long`, `str: String`), decoded through decode_jni_key_expr.
9491
.type_binding(TypeBinding::param(
9592
"KeyExpr<'static>",
96-
"Long",
97-
"*const zenoh::key_expr::KeyExpr<'static>",
98-
InlineFn::new(|input| quote! { (*std::sync::Arc::from_raw(#input)).clone() }),
93+
"io.zenoh.jni.JNIKeyExpr",
94+
"jni::objects::JObject",
95+
InlineFn::env_ref_mut("crate::key_expr::decode_jni_key_expr"),
9996
))
10097
// Encoding via JObject + custom decoder.
10198
.type_binding(TypeBinding::param(

0 commit comments

Comments
 (0)