Mark classes of package devSupport as @Nullsafe (#42723)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42723

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D53200099

fbshipit-source-id: a5b244da401fb23c9579728c7261312ab200d623
This commit is contained in:
David Vacca
2024-02-02 10:22:02 -08:00
committed by Facebook GitHub Bot
parent 4c6c57da73
commit 239f9bf7eb
12 changed files with 26 additions and 1 deletions
@@ -9,6 +9,7 @@ package com.facebook.react.devsupport;
import android.content.Context;
import androidx.annotation.Nullable;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.common.SurfaceDelegateFactory;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
@@ -24,6 +25,7 @@ import java.util.Map;
* class and its dependencies in release builds. If the class isn't found, {@link
* DisabledDevSupportManager} is returned instead.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public class DefaultDevSupportManagerFactory implements DevSupportManagerFactory {
private static final String DEVSUPPORT_IMPL_PACKAGE = "com.facebook.react.devsupport";
@@ -10,6 +10,7 @@ package com.facebook.react.devsupport;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
import com.facebook.react.packagerconnection.PackagerConnectionSettings;
@@ -19,6 +20,7 @@ import com.facebook.react.packagerconnection.PackagerConnectionSettings;
* {@link com.facebook.react.devsupport}. For accessing some of the settings by external modules
* this class implements an external interface {@link DeveloperSettings}.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
class DevInternalSettings
implements DeveloperSettings, SharedPreferences.OnSharedPreferenceChangeListener {
@@ -9,12 +9,14 @@ package com.facebook.react.devsupport;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.R;
/**
* Activity that display developers settings. Should be added to the debug manifest of the app. Can
* be triggered through the developers option menu displayed by {@link DevSupportManager}.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public class DevSettingsActivity extends PreferenceActivity {
@Override
@@ -7,8 +7,10 @@
package com.facebook.react.devsupport;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.soloader.SoLoader;
@Nullsafe(Nullsafe.Mode.LOCAL)
class DevSupportSoLoader {
private static volatile boolean sDidInit = false;
@@ -11,11 +11,13 @@ import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import com.facebook.infer.annotation.Nullsafe;
/**
* A class allows recognizing double key tap of "R", used to reload JS in {@link
* AbstractReactActivity}, {@link RedBoxDialogSurfaceDelegate} and {@link ReactActivity}.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public class DoubleTapReloadRecognizer {
private boolean mDoRefresh = false;
private static final long DOUBLE_TAP_DELAY = 200;
@@ -7,9 +7,11 @@
package com.facebook.react.devsupport;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.proguard.annotations.DoNotStrip;
/** JNI wrapper for `jsinspector_modern::InspectorFlags`. */
@Nullsafe(Nullsafe.Mode.LOCAL)
@DoNotStrip
public class InspectorFlags {
static {
@@ -11,9 +11,11 @@ import android.app.Activity;
import android.app.Dialog;
import android.view.View;
import android.view.Window;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.R;
/** Dialog for displaying JS errors in LogBox. */
@Nullsafe(Nullsafe.Mode.LOCAL)
class LogBoxDialog extends Dialog {
public LogBoxDialog(Activity context, View reactRootView) {
super(context, R.style.Theme_Catalyst_LogBox);
@@ -9,12 +9,14 @@ package com.facebook.react.devsupport;
import androidx.annotation.Nullable;
import com.facebook.fbreact.specs.NativeLogBoxSpec;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.common.SurfaceDelegate;
import com.facebook.react.devsupport.interfaces.DevSupportManager;
import com.facebook.react.module.annotations.ReactModule;
@Nullsafe(Nullsafe.Mode.LOCAL)
@ReactModule(name = NativeLogBoxSpec.NAME)
public class LogBoxModule extends NativeLogBoxSpec {
@@ -8,6 +8,7 @@
package com.facebook.react.devsupport;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback;
import java.io.IOException;
@@ -21,6 +22,7 @@ import okhttp3.Response;
import okhttp3.ResponseBody;
/** Use this class to check if the JavaScript packager is running on the provided host. */
@Nullsafe(Nullsafe.Mode.LOCAL)
public class PackagerStatusCheck {
private static final String PACKAGER_OK_STATUS = "packager-status:running";
@@ -8,11 +8,13 @@
package com.facebook.react.devsupport;
import android.content.Context;
import com.facebook.infer.annotation.Nullsafe;
/**
* Interface for accessing and interacting with development features related to performance testing.
* Communication is enabled via the Inspector, but everything else is disabled.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
public final class PerftestDevSupportManager extends DisabledDevSupportManager {
private final DevServerHelper mDevServerHelper;
private final DevInternalSettings mDevSettings;
@@ -9,12 +9,14 @@ package com.facebook.react.devsupport;
import android.os.Build;
import android.view.WindowManager;
import com.facebook.infer.annotation.Nullsafe;
/**
* Compatibility wrapper for apps targeting API level 26 or later. See
* https://developer.android.com/about/versions/oreo/android-8.0-changes.html#cwt
*/
/* package */ class WindowOverlayCompat {
/* package */ @Nullsafe(Nullsafe.Mode.LOCAL)
class WindowOverlayCompat {
private static final int TYPE_APPLICATION_OVERLAY = 2038;
@@ -7,6 +7,9 @@
package com.facebook.react.devsupport.interfaces;
import com.facebook.infer.annotation.Nullsafe;
@Nullsafe(Nullsafe.Mode.LOCAL)
public enum ErrorType {
JS("JS"),
NATIVE("Native");