diff --git a/crates/voicevox_core_java_api/src/synthesizer.rs b/crates/voicevox_core_java_api/src/synthesizer.rs index 9572c6ce6..32cdf1200 100644 --- a/crates/voicevox_core_java_api/src/synthesizer.rs +++ b/crates/voicevox_core_java_api/src/synthesizer.rs @@ -107,7 +107,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_Synthesizer_rsLoadVoice ) { throw_if_err(env, (), |env| { let model = env - .get_rust_field::<_, _, Arc>(&model, "handle")? + .get_rust_field::<_, _, crate::voice_model::VoiceModelFile>(&model, "handle")? .clone(); let model = model.read()?; let internal = env diff --git a/crates/voicevox_core_java_api/src/voice_model.rs b/crates/voicevox_core_java_api/src/voice_model.rs index 38dcc2371..ef24edbfe 100644 --- a/crates/voicevox_core_java_api/src/voice_model.rs +++ b/crates/voicevox_core_java_api/src/voice_model.rs @@ -7,7 +7,7 @@ use jni::{ JNIEnv, }; -pub(crate) type VoiceModelFile = Closable; +pub(crate) type VoiceModelFile = Arc>; impl HasJavaClassIdent for voicevox_core::blocking::VoiceModelFile { const JAVA_CLASS_IDENT: &str = "VoiceModelFile"; @@ -38,7 +38,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_VoiceModelFile_rsGetId< ) -> jobject { throw_if_err(env, std::ptr::null_mut(), |env| { let internal = env - .get_rust_field::<_, _, Arc>(&this, "handle")? + .get_rust_field::<_, _, VoiceModelFile>(&this, "handle")? .clone(); let internal = internal.read()?; @@ -55,7 +55,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_VoiceModelFile_rsGetMet ) -> jobject { throw_if_err(env, std::ptr::null_mut(), |env| { let internal = env - .get_rust_field::<_, _, Arc>(&this, "handle")? + .get_rust_field::<_, _, VoiceModelFile>(&this, "handle")? .clone(); let internal = internal.read()?; @@ -71,7 +71,7 @@ unsafe extern "system" fn Java_jp_hiroshiba_voicevoxcore_VoiceModelFile_rsClose< this: JObject<'local>, ) { throw_if_err(env, (), |env| { - env.take_rust_field::<_, _, Arc>(&this, "handle")? + env.take_rust_field::<_, _, VoiceModelFile>(&this, "handle")? .close(); Ok(()) })