Skip to content

Commit

Permalink
Add @DoNotStrip annotation to getConstants()
Browse files Browse the repository at this point in the history
Summary:
NativeModule getConstants() methods on Java might not be used within Java. So, they can be stripped by proguard. This diff adds the DoNotStrip annotation to the getConstants() method.

Changelog: [Internal]

Reviewed By: keoskate

Differential Revision: D26265874

fbshipit-source-id: b405ee32406e829212e5c9641750a6b5795899c3
  • Loading branch information
RSNara authored and facebook-github-bot committed Feb 5, 2021
1 parent b474be6 commit cba6aba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ function buildGetConstantsMethod(
return ` protected abstract Map<String, Object> getTypedExportedConstants();
@Override
@DoNotStrip
public final @Nullable Map<String, Object> getConstants() {
Map<String, Object> constants = getTypedExportedConstants();
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo
protected abstract Map<String, Object> getTypedExportedConstants();
@Override
@DoNotStrip
public final @Nullable Map<String, Object> getConstants() {
Map<String, Object> constants = getTypedExportedConstants();
if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
Expand Down

0 comments on commit cba6aba

Please sign in to comment.