Skip to content

Commit accc44e

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Fix Kotlin parameter name mismatches with supertypes (#56840)
Summary: Pull Request resolved: #56840 Fix Kotlin compiler warnings about overridden method parameter names not matching their supertypes. Rename `websocket` to `webSocket` in `WebSocketModule.onClosing` to match `WebSocketListener`, and rename `done` to `isLastChunk` in `MultipartStreamReaderTest` callbacks to match `CallCountTrackingChunkCallback`. Changelog: [Internal] Differential Revision: D105299024 fbshipit-source-id: fcf3718fbbfd342f598a05ddbe170a11480cce89
1 parent cb04956 commit accc44e

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ public class WebSocketModule(context: ReactApplicationContext) :
154154
sendEvent("websocketOpen", params)
155155
}
156156

157-
override fun onClosing(websocket: WebSocket, code: Int, reason: String) {
158-
websocket.close(code, reason)
157+
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
158+
webSocket.close(code, reason)
159159
}
160160

161161
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {

packages/react-native/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.kt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ class MultipartStreamReaderTest {
3434

3535
val callback: CallCountTrackingChunkCallback =
3636
object : CallCountTrackingChunkCallback() {
37-
override fun onChunkComplete(headers: Map<String, String>, body: Buffer, done: Boolean) {
38-
super.onChunkComplete(headers, body, done)
39-
40-
assertThat(done).isTrue
37+
override fun onChunkComplete(
38+
headers: Map<String, String>,
39+
body: Buffer,
40+
isLastChunk: Boolean,
41+
) {
42+
super.onChunkComplete(headers, body, isLastChunk)
43+
44+
assertThat(isLastChunk).isTrue
4145
assertThat(headers["Content-Type"]).isEqualTo("application/json; charset=utf-8")
4246
assertThat(body.readUtf8()).isEqualTo("{}")
4347
}
@@ -70,10 +74,14 @@ class MultipartStreamReaderTest {
7074

7175
val callback: CallCountTrackingChunkCallback =
7276
object : CallCountTrackingChunkCallback() {
73-
override fun onChunkComplete(headers: Map<String, String>, body: Buffer, done: Boolean) {
74-
super.onChunkComplete(headers, body, done)
75-
76-
assertThat(done).isEqualTo(callCount == 3)
77+
override fun onChunkComplete(
78+
headers: Map<String, String>,
79+
body: Buffer,
80+
isLastChunk: Boolean,
81+
) {
82+
super.onChunkComplete(headers, body, isLastChunk)
83+
84+
assertThat(isLastChunk).isEqualTo(callCount == 3)
7785
assertThat(body.readUtf8()).isEqualTo("$callCount")
7886
}
7987
}

0 commit comments

Comments
 (0)