mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Use ClassFinder inside ViewManagerPropertyUpdater (#44114)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44114 In OSS, we should use the ClassFinder wrapper as the `Class.byName` calls will never succeed (we don't run the annotation processor in OSS). Changelog: [Internal] [Changed] - Use ClassFinder inside ViewManagerPropertyUpdater Reviewed By: arushikesarwani94 Differential Revision: D56191175 fbshipit-source-id: a67195e983774872e27d35456b45651540411e2b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
aa7a0bc6a6
commit
56da650c90
+8
-3
@@ -9,6 +9,7 @@ package com.facebook.react.uimanager;
|
||||
|
||||
import android.view.View;
|
||||
import com.facebook.common.logging.FLog;
|
||||
import com.facebook.react.common.ClassFinder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -109,9 +110,13 @@ public class ViewManagerPropertyUpdater {
|
||||
private static <T> T findGeneratedSetter(Class<?> cls) {
|
||||
String clsName = cls.getName();
|
||||
try {
|
||||
Class<?> setterClass = Class.forName(clsName + "$$PropsSetter");
|
||||
//noinspection unchecked
|
||||
return (T) setterClass.newInstance();
|
||||
Class<?> setterClass = ClassFinder.findClass(clsName + "$$PropsSetter");
|
||||
if (setterClass != null) {
|
||||
//noinspection unchecked
|
||||
return (T) setterClass.newInstance();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
FLog.w(TAG, "Could not find generated setter for " + cls);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user