Skip to content

Commit 3643c67

Browse files
author
Mihail Slavchev
committed
refactor code
1 parent b242d17 commit 3643c67

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/jni/NativeScriptRuntime.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,7 @@ jobject NativeScriptRuntime::CreateJavaInstance(int objectID, const std::string&
566566

567567
jobjectArray javaArgs = argConverter.ToJavaArray();
568568

569-
JniLocalRef javaClassName(env.NewStringUTF(className.c_str()));
570-
JniLocalRef javaName(env.NewStringUTF(name.c_str()));
571-
572-
int ctorId = GetCachedConstructorId(env, args, name, className, javaName, javaClassName, javaArgs, methodOverrides);
569+
int ctorId = GetCachedConstructorId(env, args, name, className, javaArgs, methodOverrides);
573570

574571
jobject obj = env.CallStaticObjectMethod(PlatformClass,
575572
CREATE_INSTANCE_METHOD_ID,
@@ -595,7 +592,7 @@ jobject NativeScriptRuntime::CreateJavaInstance(int objectID, const std::string&
595592
return instance;
596593
}
597594

598-
int NativeScriptRuntime::GetCachedConstructorId(JEnv& env, const FunctionCallbackInfo<Value>& args, const string& name, const string& className, jstring javaName, jstring javaClassName, jobjectArray javaArgs, jobjectArray methodOverrides)
595+
int NativeScriptRuntime::GetCachedConstructorId(JEnv& env, const FunctionCallbackInfo<Value>& args, const string& name, const string& className, jobjectArray javaArgs, jobjectArray methodOverrides)
599596
{
600597
int ctorId = -1;
601598
string fullClassName = className + '-' + name;
@@ -609,7 +606,10 @@ int NativeScriptRuntime::GetCachedConstructorId(JEnv& env, const FunctionCallbac
609606
}
610607
else
611608
{
612-
jint id = env.CallStaticIntMethod(PlatformClass, CACHE_CONSTRUCTOR_METHOD_ID, javaName, javaClassName, javaArgs, methodOverrides);
609+
JniLocalRef javaName(env.NewStringUTF(name.c_str()));
610+
JniLocalRef javaClassName(env.NewStringUTF(className.c_str()));
611+
612+
jint id = env.CallStaticIntMethod(PlatformClass, CACHE_CONSTRUCTOR_METHOD_ID, (jstring)javaName, (jstring)javaClassName, javaArgs, methodOverrides);
613613

614614
if (env.ExceptionCheck() == JNI_FALSE)
615615
{

src/jni/NativeScriptRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ namespace tns
106106
private:
107107
NativeScriptRuntime() {}
108108

109-
static int GetCachedConstructorId(JEnv& env, const v8::FunctionCallbackInfo<v8::Value>& args, const std::string& name, const std::string& className, jstring javaName, jstring javaClassName, jobjectArray javaArgs, jobjectArray methodOverrides);
109+
static int GetCachedConstructorId(JEnv& env, const v8::FunctionCallbackInfo<v8::Value>& args, const std::string& name, const std::string& className, jobjectArray javaArgs, jobjectArray methodOverrides);
110110

111111
static v8::Handle<v8::Object> FindClass(const std::string& className);
112112

0 commit comments

Comments
 (0)