| 1358 | } |
| 1359 | |
| 1360 | pub(crate) unsafe fn get_cast_static_method() -> errors::Result<jmethodID> { |
| 1361 | get_cached!( |
| 1362 | CAST_STATIC_METHOD, |
| 1363 | { |
| 1364 | let env = get_thread_local_env()?; |
| 1365 | |
| 1366 | let cast_method_signature = format!( |
| 1367 | "(L{};Ljava/lang/String;)L{};", |
| 1368 | INVO_IFACE_NAME, INVO_IFACE_NAME |
| 1369 | ); |
| 1370 | let cstr1 = utils::to_c_string("cast"); |
| 1371 | let cstr2 = utils::to_c_string(cast_method_signature.as_ref()); |
| 1372 | |
| 1373 | // Get the method ID for the `Instance.cast` |
| 1374 | let j = unsafe { |
| 1375 | (opt_to_res(get_jni_get_static_method_id())?)( |
| 1376 | env, |
| 1377 | get_class_to_invoke_clone_and_cast()?, |
| 1378 | cstr1, |
| 1379 | cstr2, |
| 1380 | ) |
| 1381 | }; |
| 1382 | utils::drop_c_string(cstr1); |
| 1383 | utils::drop_c_string(cstr2); |
| 1384 | |
| 1385 | j |
| 1386 | }, |
| 1387 | set_cast_static_method |
| 1388 | ) |
| 1389 | } |
| 1390 | |
| 1391 | pub(crate) fn set_get_json_method(j: jmethodID) { |
| 1392 | debug("Called set_get_json_method"); |