|
1 | 1 | use itertools::Itertools; |
2 | | -use quote::quote; |
3 | 2 | use zenoh_flat::jni_converter::{ |
4 | 3 | InlineFn, JniMethodsConverter, JniStructConverter, TypeBinding, |
5 | 4 | }; |
@@ -87,15 +86,13 @@ fn shared_bindings() -> JniTypeBinding { |
87 | 86 | "jni::sys::jint", |
88 | 87 | InlineFn::pure("crate::utils::decode_reply_key_expr"), |
89 | 88 | )) |
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. |
94 | 91 | .type_binding(TypeBinding::param( |
95 | 92 | "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"), |
99 | 96 | )) |
100 | 97 | // Encoding via JObject + custom decoder. |
101 | 98 | .type_binding(TypeBinding::param( |
|
0 commit comments