Skip to content

Commit 84f40da

Browse files
dulmandakhfacebook-github-bot
authored andcommitted
@nonnull annotation for ReactPackage (#23415)
Summary: Here are some leftovers from nullable annotations for native modules, discovered while developing native module in Kotlin. This will help improve Kotlin developer experience [Android] [Changed] - Add Nonnull annotations to ReactPackage Pull Request resolved: #23415 Differential Revision: D14064607 Pulled By: cpojer fbshipit-source-id: af2ce1fc1911ee03c54b20a4fc3a6d1aba9267da
1 parent e6320c6 commit 84f40da

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ public interface ReactPackage {
3434
* @param reactContext react application context that can be used to create modules
3535
* @return list of native modules to register with the newly created catalyst instance
3636
*/
37+
@Nonnull
3738
List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext);
3839

3940
/**
4041
* @return a list of view managers that should be registered with {@link UIManagerModule}
4142
*/
43+
@Nonnull
4244
List<ViewManager> createViewManagers(@Nonnull ReactApplicationContext reactContext);
4345
}

ReactAndroid/src/main/java/com/facebook/react/modules/core/DeviceEventManagerModule.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package com.facebook.react.modules.core;
99

10+
import javax.annotation.Nonnull;
1011
import javax.annotation.Nullable;
1112

1213
import android.net.Uri;
@@ -27,7 +28,7 @@
2728
public class DeviceEventManagerModule extends ReactContextBaseJavaModule {
2829
public static final String NAME = "DeviceEventManager";
2930
public interface RCTDeviceEventEmitter extends JavaScriptModule {
30-
void emit(String eventName, @Nullable Object data);
31+
void emit(@Nonnull String eventName, @Nullable Object data);
3132
}
3233

3334
private final Runnable mInvokeDefaultBackPressRunnable;

0 commit comments

Comments
 (0)