Skip to content

Commit 911c05a

Browse files
Adam ComellaFacebook Github Bot
Adam Comella
authored and
Facebook Github Bot
committed
Android: Decrease cost of reflection
Summary: This change suppresses access checking during reflection which makes reflection faster by decreasing its overhead. **Test plan (required)** My team uses this change in our app. Adam Comella Microsoft Corp. Closes #11204 Differential Revision: D4250790 Pulled By: astreet fbshipit-source-id: 0ee2f40dcadccc695980fcae14fafe1050acb52f
1 parent 528a3c7 commit 911c05a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java

+2
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public class JavaMethod implements NativeMethod {
169169

170170
public JavaMethod(Method method) {
171171
mMethod = method;
172+
mMethod.setAccessible(true);
172173
Class[] parameterTypes = method.getParameterTypes();
173174
mArgumentExtractors = buildArgumentExtractors(parameterTypes);
174175
mSignature = buildSignature(parameterTypes);
@@ -354,6 +355,7 @@ public class SyncJavaHook implements SyncNativeHook {
354355

355356
public SyncJavaHook(Method method) {
356357
mMethod = method;
358+
mMethod.setAccessible(true);
357359
mSignature = buildSignature(method);
358360
}
359361

0 commit comments

Comments
 (0)