Commit 954589d
Fix KotlinGenericsCast lint warning in getNativeModule
Summary:
**Lint Issue:** ANDROIDLINT KotlinGenericsCast warning on line 361.
The `getNativeModule` function casts `turboModuleManager.getModule(nativeModuleName)` to generic type `T?`. The lint warns that casts to erased Kotlin generic type references are only checked at compile time, and at runtime, casts to type arguments of a generic function are unchecked due to type erasure.
**Fix:** Added `SuppressLint("KotlinGenericsCast")` annotation to the function. The existing `Suppress("UNCHECKED_CAST")` only suppresses the Kotlin compiler warning, not the AndroidLint warning. This cast is intentional and unavoidable given the API design where callers specify the expected return type.
changelog: [internal] internal
Reviewed By: alanleedev
Differential Revision: D917094811 parent ab7a5e3 commit 954589d
File tree
1 file changed
+2
-0
lines changed- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
359 | 360 | | |
360 | 361 | | |
361 | 362 | | |
| 363 | + | |
362 | 364 | | |
363 | 365 | | |
364 | 366 | | |
| |||
0 commit comments