Fix nullsafe FIXMES for ReconnectingWebSocket.java and mark nullsafe (#50354)

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

Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made ReconnectingWebSocket.java nullsafe

Reviewed By: cortinico

Differential Revision: D71979606

fbshipit-source-id: d71e26fe37bdf5abbe7b933d0fee25e05d0da87d
This commit is contained in:
Gijs Weterings
2025-04-03 08:01:59 -07:00
committed by Facebook GitHub Bot
parent f94174f2dc
commit ff6601bfb7
@@ -11,6 +11,7 @@ import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Nullsafe;
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.TimeUnit;
@@ -22,6 +23,7 @@ import okhttp3.WebSocketListener;
import okio.ByteString;
/** A wrapper around WebSocketClient that reconnects automatically */
@Nullsafe(Nullsafe.Mode.LOCAL)
public final class ReconnectingWebSocket extends WebSocketListener {
private static final String TAG = ReconnectingWebSocket.class.getSimpleName();
@@ -138,8 +140,8 @@ public final class ReconnectingWebSocket extends WebSocketListener {
}
@Override
// NULLSAFE_FIXME[Inconsistent Subclass Parameter Annotation]
public synchronized void onFailure(WebSocket webSocket, Throwable t, Response response) {
public synchronized void onFailure(
@Nullable WebSocket webSocket, Throwable t, @Nullable Response response) {
if (mWebSocket != null) {
abort("Websocket exception", t);
}