| 1149 | } |
| 1150 | |
| 1151 | pub(crate) unsafe fn get_invoke_static_method() -> errors::Result<jmethodID> { |
| 1152 | get_cached!( |
| 1153 | INVOKE_STATIC_METHOD, |
| 1154 | { |
| 1155 | let env = get_thread_local_env()?; |
| 1156 | |
| 1157 | let invoke_static_method_signature = format!( |
| 1158 | "(Ljava/lang/String;[Lorg/astonbitecode/j4rs/api/dtos/InvocationArg;)L{};", |
| 1159 | INVO_IFACE_NAME |
| 1160 | ); |
| 1161 | let cstr1 = utils::to_c_string("invokeStatic"); |
| 1162 | let cstr2 = utils::to_c_string(invoke_static_method_signature.as_ref()); |
| 1163 | // Get the method ID for the `Instance.invokeStatic` |
| 1164 | let j = unsafe { |
| 1165 | (opt_to_res(get_jni_get_method_id())?)( |
| 1166 | env, |
| 1167 | get_java_instance_class()?, |
| 1168 | cstr1, |
| 1169 | cstr2, |
| 1170 | ) |
| 1171 | }; |
| 1172 | utils::drop_c_string(cstr1); |
| 1173 | utils::drop_c_string(cstr2); |
| 1174 | |
| 1175 | j |
| 1176 | }, |
| 1177 | set_invoke_static_method |
| 1178 | ) |
| 1179 | } |
| 1180 | |
| 1181 | pub(crate) fn set_invoke_to_channel_method(j: jmethodID) { |
| 1182 | debug("Called set_invoke_to_channel_method"); |