| 910 | } |
| 911 | |
| 912 | pub(crate) unsafe fn get_factory_instantiate_method() -> errors::Result<jmethodID> { |
| 913 | get_cached!( |
| 914 | FACTORY_INSTANTIATE_METHOD, |
| 915 | { |
| 916 | let env = get_thread_local_env()?; |
| 917 | let instantiate_method_signature = format!( |
| 918 | "(Ljava/lang/String;[Lorg/astonbitecode/j4rs/api/dtos/InvocationArg;)L{};", |
| 919 | INVO_IFACE_NAME |
| 920 | ); |
| 921 | let cstr1 = utils::to_c_string("instantiate"); |
| 922 | let cstr2 = utils::to_c_string(&instantiate_method_signature); |
| 923 | let j = unsafe { |
| 924 | (opt_to_res(get_jni_get_static_method_id())?)( |
| 925 | env, |
| 926 | get_factory_class()?, |
| 927 | cstr1, |
| 928 | cstr2, |
| 929 | ) |
| 930 | }; |
| 931 | utils::drop_c_string(cstr1); |
| 932 | utils::drop_c_string(cstr2); |
| 933 | |
| 934 | j |
| 935 | }, |
| 936 | set_factory_instantiate_method |
| 937 | ) |
| 938 | } |
| 939 | |
| 940 | pub(crate) fn set_factory_create_for_static_method(j: jmethodID) { |
| 941 | debug("Called set_factory_create_for_static_method"); |