From e6c0ac0517bccc80c8b6ea08af40e21ec8c94eba Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Fri, 25 Nov 2022 08:01:18 -0800 Subject: [PATCH] Fix compilation warnings for MapBuffer Summary: We have two warnings on MapBuffer which I'd like to resolve as they show up on console every time. 1. We're using a deprecated method receiveCommand, which is actually legit but was missing a propagation of the warning. I'm adding it. 2. We had a null check that that was always not null. That is enforced by the Kotlin type system. I've checked the code and we're actually always returning non-nulls there or raising exceptions instead. Changelog: [Internal] [Changed] - Fix compilation warnings for MapBuffer Reviewed By: javache Differential Revision: D41522129 fbshipit-source-id: c2dbb660f95a2ff7dac6e4fcdf476e4058cf730e --- .../facebook/react/views/view/ReactMapBufferPropSetter.kt | 8 +++----- .../facebook/react/views/view/ReactViewManagerWrapper.kt | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt index 7218daf70cf..81080626f7f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactMapBufferPropSetter.kt @@ -255,11 +255,9 @@ object ReactMapBufferPropSetter { for (entry in mapBuffer) { val map = JavaOnlyMap() val action = entry.mapBufferValue - if (action != null) { - map.putString("name", action.getString(ACCESSIBILITY_ACTION_NAME)) - if (action.contains(ACCESSIBILITY_ACTION_LABEL)) { - map.putString("label", action.getString(ACCESSIBILITY_ACTION_LABEL)) - } + map.putString("name", action.getString(ACCESSIBILITY_ACTION_NAME)) + if (action.contains(ACCESSIBILITY_ACTION_LABEL)) { + map.putString("label", action.getString(ACCESSIBILITY_ACTION_LABEL)) } actions.add(map) } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManagerWrapper.kt b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManagerWrapper.kt index 9b04d8cc7ed..0a349409f76 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManagerWrapper.kt +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManagerWrapper.kt @@ -64,7 +64,7 @@ interface ReactViewManagerWrapper { } override fun receiveCommand(root: View, commandId: Int, args: ReadableArray?) { - viewManager.receiveCommand(root, commandId, args) + @Suppress("DEPRECATION") viewManager.receiveCommand(root, commandId, args) } override fun setPadding(view: View, left: Int, top: Int, right: Int, bottom: Int) {