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

Function call_instance_method

src/agent/lua/api_java.c:509–558  ·  view source on GitHub ↗

============================================================================= Instance method CALL =============================================================================

Source from the content-addressed store, hash-verified

507// Instance method CALL
508//=============================================================================
509static jvalue call_instance_method(JNIEnv* env, jobject instance,
510 const char* method_name, const char* signature,
511 jvalue* args) {
512 jvalue result;
513 memset(&result, 0, sizeof(result));
514
515 jclass clazz = (*env)->GetObjectClass(env, instance);
516 jmethodID method = (*env)->GetMethodID(env, clazz, method_name, signature);
517 if (!method) {
518 LOGE("Instance method not found: %s%s", method_name, signature);
519 (*env)->ExceptionClear(env);
520 return result;
521 }
522
523 ParsedSignature parsed = parse_signature(signature);
524
525 switch (parsed.return_type) {
526 case 'V':
527 (*env)->CallVoidMethodA(env, instance, method, args);
528 break;
529 case 'Z':
530 result.z = (*env)->CallBooleanMethodA(env, instance, method, args);
531 break;
532 case 'I':
533 result.i = (*env)->CallIntMethodA(env, instance, method, args);
534 break;
535 case 'J':
536 result.j = (*env)->CallLongMethodA(env, instance, method, args);
537 break;
538 case 'F':
539 result.f = (*env)->CallFloatMethodA(env, instance, method, args);
540 break;
541 case 'D':
542 result.d = (*env)->CallDoubleMethodA(env, instance, method, args);
543 break;
544 case 'L':
545 case '[':
546 result.l = (*env)->CallObjectMethodA(env, instance, method, args);
547 break;
548 default:
549 LOGE("Unknown return type: %c", parsed.return_type);
550 }
551
552 if ((*env)->ExceptionCheck(env)) {
553 (*env)->ExceptionDescribe(env);
554 (*env)->ExceptionClear(env);
555 }
556
557 return result;
558}
559
560//=============================================================================
561// Lua Bindings

Callers 1

lua_java_call_instanceFunction · 0.85

Calls 1

parse_signatureFunction · 0.85

Tested by

no test coverage detected