mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix Nullsafe FIXMEs for JSDebuggerWebSocketClient.java and mark nullsafe (#50058)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50058 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 JSDebuggerWebsocketClient.java nullsafe Reviewed By: mdvacca Differential Revision: D71126385 fbshipit-source-id: 8707e8c6b8092c0c301dc81a363758b60f38086a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
34a9ed049f
commit
3289569747
+3
-2
@@ -13,6 +13,7 @@ import android.util.JsonWriter;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.infer.annotation.Nullsafe;
|
||||
import com.facebook.react.common.JavascriptException;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import java.io.IOException;
|
||||
@@ -29,6 +30,7 @@ import okhttp3.WebSocket;
|
||||
import okhttp3.WebSocketListener;
|
||||
|
||||
/** A wrapper around WebSocketClient that recognizes RN debugging message format. */
|
||||
@Nullsafe(Nullsafe.Mode.LOCAL)
|
||||
class JSDebuggerWebSocketClient extends WebSocketListener {
|
||||
|
||||
private static final String TAG = "JSDebuggerWebSocketClient";
|
||||
@@ -210,8 +212,7 @@ class JSDebuggerWebSocketClient extends WebSocketListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
// NULLSAFE_FIXME[Inconsistent Subclass Parameter Annotation]
|
||||
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
|
||||
public void onFailure(@Nullable WebSocket webSocket, Throwable t, @Nullable Response response) {
|
||||
abort("Websocket exception", t);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class JSDebuggerWebSocketClientTest {
|
||||
val client = spy(JSDebuggerWebSocketClient())
|
||||
val injectedObjects = mapOf("key1" to "value1", "key2" to "value2")
|
||||
client.loadBundle(
|
||||
"http://localhost:8080/index.js", injectedObjects as HashMap<String, String>?, cb)
|
||||
"http://localhost:8080/index.js", injectedObjects as HashMap<String, String>, cb)
|
||||
verify(client)
|
||||
.sendMessage(
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user