File tree 2 files changed +32
-1
lines changed
ReactAndroid/src/main/java/com/facebook/react/bridge 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,17 @@ private void findMethods() {
78
78
Systrace .beginSection (TRACE_TAG_REACT_JAVA_BRIDGE , "findMethods" );
79
79
Set <String > methodNames = new HashSet <>();
80
80
81
- Method [] targetMethods = mModuleClass .getDeclaredMethods ();
81
+ Class <? extends NativeModule > classForMethods = mModuleClass ;
82
+ Class <? extends NativeModule > superClass =
83
+ (Class <? extends NativeModule >) mModuleClass .getSuperclass ();
84
+ if (ReactModuleWithSpec .class .isAssignableFrom (superClass )) {
85
+ // For java module that is based on generated flow-type spec, inspect the
86
+ // spec abstract class instead, which is the super class of the given java
87
+ // module.
88
+ classForMethods = superClass ;
89
+ }
90
+ Method [] targetMethods = classForMethods .getDeclaredMethods ();
91
+
82
92
for (Method targetMethod : targetMethods ) {
83
93
ReactMethod annotation = targetMethod .getAnnotation (ReactMethod .class );
84
94
if (annotation != null ) {
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ */
9
+
10
+ package com .facebook .react .bridge ;
11
+
12
+ import com .facebook .proguard .annotations .DoNotStrip ;
13
+
14
+ /**
15
+ * An interface to be implemented by react modules that extends from the
16
+ * generated spec class.
17
+ * This is experimental.
18
+ */
19
+ @ DoNotStrip
20
+ public interface ReactModuleWithSpec {
21
+ }
You can’t perform that action at this time.
0 commit comments