Fix infinite recursion in ReactPropAnnotationSetterSpecTest (#55662)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55662

Fix infinite recursion bugs in `ReactPropAnnotationSetterSpecTest.kt`:

- `createShadowNodeInstance()` (line 25): Method calls itself recursively instead of creating a shadow node instance. Fixed to return `ReactShadowNodeImpl()`, which is the concrete implementation of `ReactShadowNode`.
- `createViewInstance(reactContext)` (line 30): Method calls itself recursively instead of creating a view instance. Fixed to return `View(reactContext)`, which creates a basic Android View.

Both methods are in an abstract inner `BaseViewManager` test class used to satisfy the `ViewManager` abstract contract. The test class is only used to verify `ReactProp` annotation validation, so these methods just need to return valid instances.

Detected by InfiniteRecursion lint detector (D93897169).

Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D93927939

fbshipit-source-id: b971f1fbc9e0c216e2cb9db642f34a6cbf38394a
This commit is contained in:
Ron Edelstein authored and meta-codesync[bot] committed 2026-02-23 02:09:45 -08:00
1 parent 352d73bef0
commit aabdf55f0d
1 file changed
+2 -3
@@ -22,12 +22,11 @@ class ReactPropAnnotationSetterSpecTest {
private abstract inner class BaseViewManager : ViewManager<View, ReactShadowNode<*>>() {
override fun getName(): String = "IgnoredName"
override fun createShadowNodeInstance(): ReactShadowNode<*> = createShadowNodeInstance()
override fun createShadowNodeInstance(): ReactShadowNode<*> = ReactShadowNodeImpl()
override fun getShadowNodeClass(): Class<out ReactShadowNode<*>> = ReactShadowNode::class.java
override fun createViewInstance(reactContext: ThemedReactContext): View =
createViewInstance(reactContext)
override fun createViewInstance(reactContext: ThemedReactContext): View = View(reactContext)
override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? = null