MCPcopy Create free account
hub / github.com/Ahmeth4n/renef / java_new

Function java_new

src/agent/lua/api_java.c:378–398  ·  view source on GitHub ↗

============================================================================= $new() =============================================================================

Source from the content-addressed store, hash-verified

376// $new()
377//=============================================================================
378static jobject java_new(JNIEnv* env, JavaClassWrapper* wrapper,
379 const char* constructor_sig, jvalue* args) {
380
381 jmethodID constructor = (*env)->GetMethodID(env, wrapper->clazz, "<init>", constructor_sig);
382 if (!constructor) {
383 LOGE("Constructor not found: %s", constructor_sig);
384 (*env)->ExceptionClear(env);
385 return NULL;
386 }
387
388 jobject instance = (*env)->NewObjectA(env, wrapper->clazz, constructor, args);
389 if ((*env)->ExceptionCheck(env)) {
390 (*env)->ExceptionDescribe(env);
391 (*env)->ExceptionClear(env);
392 LOGE("Failed to create instance");
393 return NULL;
394 }
395
396 LOGI("Created new instance of %s", wrapper->class_name);
397 return instance;
398}
399
400//=============================================================================
401// Static method CALL

Callers 1

lua_java_newFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected