mirror of
https://github.com/status-im/react-native.git
synced 2025-01-28 02:04:55 +00:00
Add some helper methods to JStackTraceElement
Reviewed By: mhorowitz Differential Revision: D5069764 fbshipit-source-id: e2073ab824c357b28e00838abc768d402905207d
This commit is contained in:
parent
99f8c5df37
commit
74a70fea97
@ -557,10 +557,15 @@ class PinnedPrimitiveArray {
|
||||
friend class JPrimitiveArray<typename jtype_traits<T>::array_type>;
|
||||
};
|
||||
|
||||
struct JStackTraceElement : JavaClass<JStackTraceElement> {
|
||||
struct FBEXPORT JStackTraceElement : JavaClass<JStackTraceElement> {
|
||||
static auto constexpr kJavaDescriptor = "Ljava/lang/StackTraceElement;";
|
||||
|
||||
static local_ref<javaobject> create(const std::string& declaringClass, const std::string& methodName, const std::string& file, int line);
|
||||
|
||||
std::string getClassName() const;
|
||||
std::string getMethodName() const;
|
||||
std::string getFileName() const;
|
||||
int getLineNumber() const;
|
||||
};
|
||||
|
||||
/// Wrapper to provide functionality to jthrowable references
|
||||
|
@ -184,6 +184,26 @@ auto JStackTraceElement::create(
|
||||
return newInstance(declaringClass, methodName, file, line);
|
||||
}
|
||||
|
||||
std::string JStackTraceElement::getClassName() const {
|
||||
static auto meth = javaClassStatic()->getMethod<local_ref<JString>()>("getClassName");
|
||||
return meth(self())->toStdString();
|
||||
}
|
||||
|
||||
std::string JStackTraceElement::getMethodName() const {
|
||||
static auto meth = javaClassStatic()->getMethod<local_ref<JString>()>("getMethodName");
|
||||
return meth(self())->toStdString();
|
||||
}
|
||||
|
||||
std::string JStackTraceElement::getFileName() const {
|
||||
static auto meth = javaClassStatic()->getMethod<local_ref<JString>()>("getFileName");
|
||||
return meth(self())->toStdString();
|
||||
}
|
||||
|
||||
int JStackTraceElement::getLineNumber() const {
|
||||
static auto meth = javaClassStatic()->getMethod<jint()>("getLineNumber");
|
||||
return meth(self());
|
||||
}
|
||||
|
||||
// Translate C++ to Java Exception
|
||||
|
||||
namespace {
|
||||
|
Loading…
x
Reference in New Issue
Block a user