Skip to content

Commit 55bb944

Browse files
committed
add prerequisites removed
1 parent 7671a22 commit 55bb944

3 files changed

Lines changed: 1 addition & 28 deletions

File tree

prebindgen-ext/src/jni/jni_ext.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,6 @@ pub struct JniExt {
373373
/// Per-rank output wrappers. Same shape as [`Self::input_wrappers`].
374374
pub(crate) output_wrappers: [HashMap<TypeKey, WrapperFn>; 4],
375375

376-
/// Author-supplied Rust items prepended to the generated file before
377-
/// the framework's own prerequisites. Use for `use crate::errors::X;`
378-
/// statements that bring any identifiers used in the binding's
379-
/// converter patterns into scope at the include site (e.g. the
380-
/// `ZResult<_>` alias zenoh registers a throwing converter for).
381-
pub(crate) extra_prerequisites: Vec<syn::Item>,
382-
383376
/// Tracks the last [`Self::kotlin_class`] key registered so
384377
/// [`Self::method`] / [`Self::suppress_kotlin_code`] know which
385378
/// entry to extend. Cleared after each unrelated builder call.
@@ -434,7 +427,6 @@ impl JniExt {
434427
HashMap::new(),
435428
HashMap::new(),
436429
],
437-
extra_prerequisites: Vec::new(),
438430
last_opaque_key: None,
439431
last_meta_key: None,
440432
last_exception_idx: None,
@@ -508,18 +500,6 @@ impl JniExt {
508500
self
509501
}
510502

511-
/// Inject an extra Rust item (typically a `use` statement) into the
512-
/// preamble of the generated file. Use this to bring identifiers
513-
/// referenced by `output_throws` / `output_wrapper` patterns into
514-
/// scope at the include site — e.g. `use crate::errors::ZResult;`
515-
/// for a binding whose `#[prebindgen]` fns return `ZResult<T>` and
516-
/// whose registered converter patterns use the same bare name.
517-
/// The framework itself stays unaware of these aliases.
518-
pub fn add_prerequisite(mut self, item: syn::Item) -> Self {
519-
self.extra_prerequisites.push(item);
520-
self
521-
}
522-
523503
/// Register an output converter that may raise a JVM exception.
524504
/// **Must be chained immediately after a [`Self::kotlin_exception_class`]
525505
/// call** — the registration is scoped to that exception, and the
@@ -1600,7 +1580,6 @@ impl PrebindgenExt for JniExt {
16001580
pub(crate) type __JniErr = #error_type;
16011581
);
16021582
let mut items = vec![alias];
1603-
items.extend(self.extra_prerequisites.iter().cloned());
16041583
items.extend(owned_object_prerequisite_items());
16051584
// Throw fns — one `pub(crate) fn throw_<short>(env, &err)` per
16061585
// registered `kotlin_exception_class`. Emitted as prerequisites

zenoh-jni/build.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ use prebindgen_ext::jni::JniExt;
1717
fn main() {
1818
let jni = JniExt::new()
1919
.source_module("zenoh_flat")
20-
// Bring `zenoh-flat`'s `ZResult<T>` alias into scope at the
21-
// generated file: the source `#[prebindgen]` fns return it by
22-
// short name, and the `output_throws("ZResult < _ >", ...)`
23-
// registration below takes a `v: ZResult<T>` parameter, so the
24-
// identifier must resolve in the include site. The framework
25-
// itself stays unaware of any specific Result-shape alias.
26-
.add_prerequisite(syn::parse_quote!(use zenoh_flat::errors::ZResult;))
2720
.package("io.zenoh.jni")
2821
.jni_method_suffix("ViaJNI")
2922
// Single error type spliced into every generated `Result<_, _>`

zenoh-jni/src/generated.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use zenoh::{
3636
#[cfg(feature = "zenoh-ext")]
3737
use zenoh_ext::{AdvancedPublisher, AdvancedSubscriber};
3838
use zenoh_flat::sample::Sample;
39+
use zenoh_flat::errors::ZResult;
3940
#[cfg(feature = "zenoh-ext")]
4041
use zenoh_flat::structs::{CacheConfig, HistoryConfig, MissDetectionConfig, RecoveryConfig};
4142

0 commit comments

Comments
 (0)