Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonnull annotations for native modules #23353

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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<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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package com.facebook.react.bridge;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import android.app.Activity;
Expand All @@ -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;
}

Expand Down