Skip to content
Permalink
Browse files

Nonnull annotations for native modules (#23353)

Summary:
This adds Nonnull annotations for interfaces and classes used for native modules for Android, to improve Kotlin developer experience, but also code quality checks.

[Android] [Changed] - Nonnull annotations for native module interfaces
Pull Request resolved: #23353

Differential Revision: D14018181

Pulled By: mdvacca

fbshipit-source-id: 09a583860a6075e1d6f6df8f479369ae96497133
  • Loading branch information...
dulmandakh authored and facebook-github-bot committed Feb 9, 2019
1 parent d9f34bd commit c93cbdf1b272cfd60124d9ddb4c52b58ca59d319
@@ -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 @@
* @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<NativeModule> createNativeModules(ReactApplicationContext reactContext);
List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext);

/**
* @return a list of view managers that should be registered with {@link UIManagerModule}
*/
List<ViewManager> createViewManagers(ReactApplicationContext reactContext);
List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext);
}
@@ -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 @@
* @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()}
@@ -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 @@

private final ReactApplicationContext mReactApplicationContext;

public ReactContextBaseJavaModule(ReactApplicationContext reactContext) {
public ReactContextBaseJavaModule(@Nonnull ReactApplicationContext reactContext) {
mReactApplicationContext = reactContext;
}

0 comments on commit c93cbdf

Please sign in to comment.
You can’t perform that action at this time.