Skip to content

Commit 2c1726a

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Suppress unused androidx.core.content.res.use warning (facebook#51272)
Summary: Follow up from facebook#51170, static code analysis shows androidx.core.content.res.use as unused, it looked pretty harmless to remove it as there was no context about its usage, but it caused some crashes. I'm suppressing the warning here, plus adding an explanation on why it is needed to prevent a future developer from touching this file and causing the same regression. ## Changelog: [INTERNAL] - Suppress unused androidx.core.content.res.use warning Pull Request resolved: facebook#51272 Test Plan: Static code analysis should not show the import as unused. Reviewed By: cortinico Differential Revision: D74642726 Pulled By: rshest fbshipit-source-id: 14cec4fe92f06827636410df4b88a3b7088abe52
1 parent f5fba73 commit 2c1726a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/DefaultStyleValuesUtil.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8+
// Suppress unused import warning to ensure the correct `use` extension is applied.
9+
// Removing [androidx.core.content.res.use] import causes Kotlin to fallback to `kotlin.io.use`,
10+
// which expects `AutoCloseable`.
11+
// However, `TypedArray` is not `AutoCloseable`, and this mismatch can lead to crashes like
12+
// IncompatibleClassChangeError.
13+
@file:Suppress("UnusedImport")
14+
815
package com.facebook.react.views.text
916

1017
import android.content.Context

0 commit comments

Comments
 (0)