Skip to main content

jni/objects/
jstack_trace_element.rs

1crate::bind_java_type! {
2    pub JStackTraceElement => "java.lang.StackTraceElement",
3    methods {
4        /// Get the class name of the stack trace element.
5        fn get_class_name() -> JString,
6        /// Get the file name of the stack trace element, if available.
7        fn get_file_name() -> JString,
8        /// Get the line number of the stack trace element.
9        fn get_line_number() -> jint,
10        /// Get the method name of the stack trace element.
11        fn get_method_name() -> JString,
12        /// Check if the stack trace element corresponds with a native method.
13        fn is_native_method() -> bool,
14        /// Returns a string representation of this stack trace element.
15        fn try_to_string {
16            name = "toString",
17            sig = () -> JString,
18        }
19    }
20}
21
22impl<'local> JStackTraceElement<'local> {
23    // In jni 0.22.0 and 0.22.1 we were incorrectly trying to lookup an isNative
24    // method and although it was impossible to call (because this API binding
25    // would fail to initialize) we also exported a public `is_native()` method
26    // that code could potentially have linked against.
27    #[doc(hidden)]
28    #[deprecated(since = "0.22.1", note = "Use `is_native_method` instead")]
29    pub fn is_native<'env_local>(
30        &self,
31        env: &::jni::Env<'env_local>,
32    ) -> ::jni::errors::Result<bool> {
33        self.is_native_method(env)
34    }
35}