A framework for building native applications using React
Migrate ViewManagersPropertyCache to Kotlin (#56911)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56911
Convert `ViewManagersPropertyCache` from Java to Kotlin as part of the ongoing React Native Android migration to 100% Kotlin. The class is package-private (now `internal`) and is only consumed by `ViewManagerPropertyUpdater`, so there is no public OSS-visible API change. The public `PropSetter` getters `getPropName()` / `getPropType()` are preserved as Kotlin `val` properties with the same JVM signatures, keeping byte-compatibility with the existing Kotlin caller.
Adjacent changes in this revision:
- Drop the `VIEW_MGR_ARGS` / `VIEW_MGR_GROUP_ARGS` / `SHADOW_ARGS` / `SHADOW_GROUP_ARGS` `ThreadLocal` caches. Their purpose in the Java version was to avoid the per-call `Object[]` allocation that `Method.invoke`'s varargs would otherwise force; in Kotlin, the spread operator (`*args`) emits a defensive array copy on every call, so the caches no longer save anything. Calling `setter.invoke(viewManager, viewToUpdate, ...)` with positional arguments has the same allocation cost and removes the dead complexity.
- Restore the original non-null parameter contract on `getNativePropSettersForShadowNodeClass`: the recursion now bottoms out by reading `cls.superclass` once and only recursing when it is non-null, matching the Java behavior without widening the public/internal API.
- Add `Suppress("DEPRECATION")` at the file level since `PropSetter.updateShadowNodeProp` legitimately consumes the deprecated `ReactShadowNode` API surface.
- Remove `ViewManagersPropertyCache.java` from the `ReactNoNewJavaDetector` allow-list.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D105847022
fbshipit-source-id: 99d1b49c9dde40879c0a2f4ccd7eee340b4c1646 N
Nicola Corti committed
26790cfecb196aa4eaff8bb14cefecf2e26b72b4
Parent: eeb17ba
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 5/21/2026, 11:17:17 AM