From 8f5fb554d305e2d5508974ec2b3d03d58d8eda0b Mon Sep 17 00:00:00 2001 From: Dulmandakh Date: Sat, 9 Feb 2019 17:10:26 +0800 Subject: [PATCH] Nonnull annotations for ReactPackage, NativeModule and ReactContextBaseJavaModule --- .../src/main/java/com/facebook/react/ReactPackage.java | 6 ++++-- .../main/java/com/facebook/react/bridge/NativeModule.java | 4 +++- .../facebook/react/bridge/ReactContextBaseJavaModule.java | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java index 0dd952216a8c09..527db0ace2e544 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java @@ -13,6 +13,8 @@ import com.facebook.react.uimanager.ViewManager; import java.util.List; +import javax.annotation.Nonnull; + /** * Main interface for providing additional capabilities to the catalyst framework by couple of * different means: @@ -32,10 +34,10 @@ public interface ReactPackage { * @param reactContext react application context that can be used to create modules * @return list of native modules to register with the newly created catalyst instance */ - List createNativeModules(ReactApplicationContext reactContext); + List createNativeModules(@Nonnull ReactApplicationContext reactContext); /** * @return a list of view managers that should be registered with {@link UIManagerModule} */ - List createViewManagers(ReactApplicationContext reactContext); + List createViewManagers(@Nonnull ReactApplicationContext reactContext); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java index 44d65b11f53a9b..14224ca10a285c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java @@ -9,6 +9,8 @@ import com.facebook.proguard.annotations.DoNotStrip; +import javax.annotation.Nonnull; + /** * A native module whose API can be provided to JS catalyst instances. {@link NativeModule}s whose @@ -28,7 +30,7 @@ interface NativeMethod { * @return the name of this module. This will be the name used to {@code require()} this module * from javascript. */ - String getName(); + @Nonnull String getName(); /** * This is called at the end of {@link CatalystApplicationFragment#createCatalystInstance()} diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java index 00ff1173067613..0fe9ac13a591bf 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java @@ -7,6 +7,7 @@ package com.facebook.react.bridge; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import android.app.Activity; @@ -19,7 +20,7 @@ public abstract class ReactContextBaseJavaModule extends BaseJavaModule { private final ReactApplicationContext mReactApplicationContext; - public ReactContextBaseJavaModule(ReactApplicationContext reactContext) { + public ReactContextBaseJavaModule(@Nonnull ReactApplicationContext reactContext) { mReactApplicationContext = reactContext; }