Permalink
Browse files

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
  • Loading branch information...
1 parent 528a3c7 commit 911c05a89bbe86e9c805d7eee58cdfd66b80a64c @rigdern rigdern committed with Facebook Github Bot Nov 30, 2016
Showing with 2 additions and 0 deletions.
  1. +2 −0 ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java
@@ -169,6 +169,7 @@ public Promise extractArgument(
public JavaMethod(Method method) {
mMethod = method;
+ mMethod.setAccessible(true);
Class[] parameterTypes = method.getParameterTypes();
mArgumentExtractors = buildArgumentExtractors(parameterTypes);
mSignature = buildSignature(parameterTypes);
@@ -354,6 +355,7 @@ public String getType() {
public SyncJavaHook(Method method) {
mMethod = method;
+ mMethod.setAccessible(true);
mSignature = buildSignature(method);
}

0 comments on commit 911c05a

Please sign in to comment.