Skip to content

Commit 26790cf

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Migrate ViewManagersPropertyCache to Kotlin (#56911)
Summary: Pull Request resolved: #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
1 parent eeb17ba commit 26790cf

2 files changed

Lines changed: 527 additions & 614 deletions

File tree

0 commit comments

Comments
 (0)