alibaba / alibaba/AndFix

为什么最后要用java.lang.reflect.Method来invoke修复后的java方法,而不是通过JNIEnv直接调用,如env->GetStaticMethodID?

Open
#157 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

R.T.
dalvik_method_replace.cpp文件的dalvik_dispatcher方法中
`dvmCallMethod_fnPtr(self, (Method*) jInvokeMethod,
dvmCreateReflectMethodObject_fnPtr(meth), &result, NULL, argArray);`
这一句是通过java.lang.reflect.Method的invoke方法来调用修复后的java方法

为什么不直接通过JNIEnv调用java方法呢?如下:
`env->GetStaticMethodID(jclass, “methodName”, “Ljava/lang/String;)V”);`
求答复,谢谢!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in dalvik_method_replace.cpp at dalvik_dispatcher and trace the dvmCallMethod_fnPtr call using java.lang.reflect.Method. Compare that path with the proposed JNIEnv->GetStaticMethodID approach and document why the implementation uses reflection; done means the rationale is recorded clearly for Android hot-fix contributors.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp, java
Domain
mobile
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.