MCPcopy Create free account
hub / github.com/cretz/stackparam / get_stack_params_field

Function get_stack_params_field

src/native.rs:304–322  ·  view source on GitHub ↗
(jni_env: *mut JNIEnv)

Source from the content-addressed store, hash-verified

302}
303
304unsafe fn get_stack_params_field(jni_env: *mut JNIEnv) -> Result<jfieldID, String> {
305 static mut STACK_PARAMS_FIELD: jfieldID = 0 as jfieldID;
306 static ONCE: Once = ONCE_INIT;
307 ONCE.call_once(|| {
308 let throwable_class = get_throwable_class(jni_env).unwrap_or(ptr::null_mut());
309 if !throwable_class.is_null() {
310 // We swallow exceptions in here on purpose
311 let field_name_str = CString::new("stackParams").unwrap();
312 let field_sig_str = CString::new("[[Ljava/lang/Object;").unwrap();
313 STACK_PARAMS_FIELD = (**jni_env).GetFieldID.unwrap()(jni_env,
314 throwable_class,
315 field_name_str.as_ptr(),
316 field_sig_str.as_ptr());
317 let _ = util::result_or_jni_ex((), jni_env);
318 }
319 });
320 if STACK_PARAMS_FIELD.is_null() { return Result::Err("No stackParams field".to_string()); }
321 return Result::Ok(STACK_PARAMS_FIELD);
322}
323
324unsafe fn get_stack_trace_depth(jni_env: *mut JNIEnv, this: jobject) -> Result<jint, String> {
325 static mut STACK_DEPTH_METH: jmethodID = 0 as jmethodID;

Callers 3

add_element_paramsFunction · 0.85
populate_stack_paramsFunction · 0.85

Calls 2

get_throwable_classFunction · 0.85
result_or_jni_exFunction · 0.85

Tested by

no test coverage detected