Migrate Nullable and NonNull annotations to AndroidX

Summary:
This diff migrates the usages Nullable and NonNull annotations to AndroidX instead of javax.

The purpose of this change is to bring consistency in the annotations used by the core of RN

Reviewed By: makovkastar

Differential Revision: D16054504

fbshipit-source-id: 21d888854da088d2a14615a90d4dc058e5286b91
This commit is contained in:
David Vacca
2019-07-11 16:16:46 -07:00
committed by Facebook Github Bot
parent 96318e438f
commit aa5edca0e2
253 changed files with 432 additions and 384 deletions
@@ -7,11 +7,10 @@
package com.facebook.react.bridge;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.infer.annotation.Assertions;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Implementation of a write-only map stored in native memory. Use {@link Arguments#createMap()} if
@@ -24,23 +23,22 @@ public class WritableNativeMap extends ReadableNativeMap implements WritableMap
}
@Override
public native void putBoolean(@Nonnull String key, boolean value);
public native void putBoolean(@NonNull String key, boolean value);
@Override
public native void putDouble(@Nonnull String key, double value);
public native void putDouble(@NonNull String key, double value);
@Override
public native void putInt(@Nonnull String key, int value);
@Override
public native void putString(@Nonnull String key, @Nullable String value);
public native void putInt(@NonNull String key, int value);
@Override
public native void putNull(@NonNull String key);
// Note: this consumes the map so do not reuse it.
@Override
public void putMap(@Nonnull String key, @Nullable ReadableMap value) {
public native void putString(@NonNull String key, @Nullable String value);
@Override
public void putMap(@NonNull String key, @Nullable ReadableMap value) {
Assertions.assertCondition(
value == null || value instanceof WritableNativeMap, "Illegal type provided");
putNativeMap(key, (WritableNativeMap) value);
@@ -48,7 +46,7 @@ public class WritableNativeMap extends ReadableNativeMap implements WritableMap
// Note: this consumes the map so do not reuse it.
@Override
public void putArray(@Nonnull String key, @Nullable ReadableArray value) {
public void putArray(@NonNull String key, @Nullable ReadableArray value) {
Assertions.assertCondition(
value == null || value instanceof WritableNativeArray, "Illegal type provided");
putNativeArray(key, (WritableNativeArray) value);
@@ -56,7 +54,7 @@ public class WritableNativeMap extends ReadableNativeMap implements WritableMap
// Note: this **DOES NOT** consume the source map
@Override
public void merge(@Nonnull ReadableMap source) {
public void merge(@NonNull ReadableMap source) {
Assertions.assertCondition(source instanceof ReadableNativeMap, "Illegal type provided");
mergeNativeMap((ReadableNativeMap) source);
}