MCPcopy Create free account
hub / github.com/NativeScript/android / ResolveConstructor

Method ResolveConstructor

test-app/runtime/src/main/cpp/MethodCache.cpp:240–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240string MethodCache::ResolveConstructor(const FunctionCallbackInfo<Value>& args, jclass javaClass, bool isInterface) {
241 JEnv env;
242 string resolvedSignature;
243
244 JsArgToArrayConverter argConverter(args, isInterface);
245 if (argConverter.IsValid()) {
246 jobjectArray javaArgs = argConverter.ToJavaArray();
247
248 auto runtime = Runtime::GetRuntime(args.GetIsolate());
249
250 jstring signature = (jstring) env.CallObjectMethod(runtime->GetJavaRuntime(), RESOLVE_CONSTRUCTOR_SIGNATURE_ID, javaClass, javaArgs);
251
252 const char* str = env.GetStringUTFChars(signature, nullptr);
253 resolvedSignature = string(str);
254 env.ReleaseStringUTFChars(signature, str);
255 env.DeleteLocalRef(signature);
256 } else {
257 JsArgToArrayConverter::Error err = argConverter.GetError();
258 throw NativeScriptException(err.msg);
259 }
260
261 return resolvedSignature;
262}
263
264robin_hood::unordered_map<string, MethodCache::CacheMethodInfo> MethodCache::s_mthod_ctor_signature_cache;
265jclass MethodCache::RUNTIME_CLASS = nullptr;

Callers

nothing calls this directly

Calls 10

ToJavaArrayMethod · 0.80
CallObjectMethodMethod · 0.80
GetJavaRuntimeMethod · 0.80
GetStringUTFCharsMethod · 0.80
ReleaseStringUTFCharsMethod · 0.80
DeleteLocalRefMethod · 0.80
IsValidMethod · 0.45
GetIsolateMethod · 0.45
GetErrorMethod · 0.45

Tested by

no test coverage detected