mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Add Android 17 safety comment for JNI-written static field (#56442)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/56442 AppearanceModule.invalidatePlatformColorCache is set from native via JNI (configurePlatformColorCacheInvalidationHook.cpp). Android 17 crashes if JNI modifies a static final field. Since Kotlin `val` compiles to static final, this field must remain `var`. Added a comment to prevent accidental refactoring. See https://developer.android.com/about/versions/17/behavior-changes-17#static-final-fields Changelog: [Internal] ___ overriding_review_checks_triggers_an_audit_and_retroactive_review Oncall Short Name: react_native Differential Revision: D100831802 fbshipit-source-id: ab52b01337e8dd90f8db2766afd00fbaa4a41018
This commit is contained in:
1 parent
0517fb552d
commit
95e0b5e2e2
1 file changed
+3
+3
@@ -137,6 +137,9 @@ constructor(
|
||||
public const val NAME: String = NativeAppearanceSpec.NAME
|
||||
private const val APPEARANCE_CHANGED_EVENT_NAME = "appearanceChanged"
|
||||
|
||||
// Must remain `var` (not `val`) — this field is set from JNI in
|
||||
// configurePlatformColorCacheInvalidationHook.cpp. Android 17+ crashes
|
||||
// if JNI modifies a static final field (which `val` compiles to).
|
||||
@DoNotStrip private var invalidatePlatformColorCache: Runnable? = null
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user