-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
Java/JNICase specific only for Java/JNI interface generationCase specific only for Java/JNI interface generationenhancement
Description
If you have a lib.rs and a java_glue.rs.in, this will not work:
// lib.rs
mod java_glue;
pub enum RecursiveEnum {
Null,
S
}
#[derive(Debug, Clone, Default)]
pub struct Lol {
pub s: String,
}
#[derive(Debug, Clone, Default)]
pub struct RecursiveFoo {
pub s: String,
pub child: Vec<RecursiveFoo>,
}
impl RecursiveFoo {
pub fn new(s: String, child: Vec<RecursiveFoo>) -> Self {
Self { s, child }
}
}// java_glue.rs.in
use crate::*;
use jni_sys::*;
foreign_class!(class Lol {
self_type Lol;
constructor Lol::default() -> Lol;
});
foreign_class!(class RecursiveFoo {
self_type RecursiveFoo;
constructor RecursiveFoo::new(s: String, child: Vec<RecursiveFoo>) -> RecursiveFoo;
});You will get an error like:
error: failed to run custom build command for `lol2_lib_android2 v0.1.0 (/Users/austin/work/android.debug/my_repo/lol/lib_android2)`
Caused by:
process didn't exit successfully: `/Users/austin/work/android.debug/lol/target/release/build/lol_lib_android2-e0e77b6c90dc0964/build-script-build` (exit status: 101)
--- stderr
error in android bindings: src/java_glue.rs.in
parsing of android bindings: src/java_glue.rs.in failed
error: Do not know conversion from Java type to such rust type 'Vec < RecursiveFoo >'
constructor RecursiveFoo::new(s: String, child: Vec<RecursiveFoo>) -> RecursiveFoo;
^^^^^^^^^^^^^^^^^
At android bindings: src/java_glue.rs.in:10:53
thread 'main' panicked at 'explicit panic', /Users/austin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flapigen-0.6.0/src/error.rs:88:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Recipe `build-android-lib2` failed with exit code 101
but this type is acceptable to Rust if you compile without the build script.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Java/JNICase specific only for Java/JNI interface generationCase specific only for Java/JNI interface generationenhancement