From aabdf55f0dbd9dcfbf2a50a0c67b8b79bdd4fc88 Mon Sep 17 00:00:00 2001 From: Ron Edelstein Date: Mon, 23 Feb 2026 02:09:45 -0800 Subject: [PATCH] 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 --- .../react/uimanager/ReactPropAnnotationSetterSpecTest.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.kt index 352b3945687..9cac4350957 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.kt @@ -22,12 +22,11 @@ class ReactPropAnnotationSetterSpecTest { private abstract inner class BaseViewManager : ViewManager>() { override fun getName(): String = "IgnoredName" - override fun createShadowNodeInstance(): ReactShadowNode<*> = createShadowNodeInstance() + override fun createShadowNodeInstance(): ReactShadowNode<*> = ReactShadowNodeImpl() override fun getShadowNodeClass(): Class> = 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