From 44ae23c2542dc851e9d5030044c38f2c21b20c5e Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Mon, 18 Sep 2023 03:07:20 -0700 Subject: [PATCH] Remove unused `canLoadFile` function from HermesExecutor.java (#39481) Summary: This function is hardcoded to `true` and is never used, so I'm removing it. I found no relevant usages in OSS so that can probably go. Also see: https://github.com/facebook/react-native/issues/39292 where it got reported. Changelog: [Android] [Removed] - Remove unused `canLoadFile` function from HermesExecutor.java Reviewed By: yungsters, mdvacca Differential Revision: D49320244 --- .../facebook/hermes/reactexecutor/HermesExecutor.java | 9 --------- .../src/main/jni/react/hermes/reactexecutor/OnLoad.cpp | 7 +------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java index c8d81b725d282e..514121bbf89ac4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutor.java @@ -42,15 +42,6 @@ public String getName() { return "HermesExecutor" + mode_; } - /** - * Return whether this class can load a file at the given path, based on a binary compatibility - * check between the contents of the file and the Hermes VM. - * - * @param path the path containing the file to inspect. - * @return whether the given file is compatible with the Hermes VM. - */ - public static native boolean canLoadFile(String path); - private static native HybridData initHybridDefaultConfig( boolean enableDebugger, String debuggerName); diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp index 0df6d96a84de44..035b511e35515f 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/hermes/reactexecutor/OnLoad.cpp @@ -90,17 +90,12 @@ class HermesExecutorHolder return makeCxxInstance(std::move(factory)); } - static bool canLoadFile(jni::alias_ref, const std::string& path) { - return true; - } - static void registerNatives() { registerHybrid( {makeNativeMethod("initHybrid", HermesExecutorHolder::initHybrid), makeNativeMethod( "initHybridDefaultConfig", - HermesExecutorHolder::initHybridDefaultConfig), - makeNativeMethod("canLoadFile", HermesExecutorHolder::canLoadFile)}); + HermesExecutorHolder::initHybridDefaultConfig)}); } private: