Skip to content

Commit 8876f3d

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Fix lint issues in ReactInstanceManager.java (#55375)
Summary: Fixed multiple lint errors in ReactInstanceManager.java: - NonStaticNestedClass: Made ReactContextInitParams class static since it doesn't need to access instance members - ClownyBooleanExpression: Removed unnecessary `if (true)` wrapper around throw statement - DeadVariable: Removed unused devSettings variable - EmptyCatchBlock: Added explanatory comment for InterruptedException handling changelog: [internal] internal Reviewed By: javache Differential Revision: D91814708
1 parent cfb6303 commit 8876f3d

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
9494
import com.facebook.react.modules.core.DeviceEventManagerModule;
9595
import com.facebook.react.modules.core.ReactChoreographer;
96-
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
9796
import com.facebook.react.packagerconnection.RequestHandler;
9897
import com.facebook.react.uimanager.DisplayMetricsHolder;
9998
import com.facebook.react.uimanager.ReactRoot;
@@ -194,7 +193,7 @@ public interface ReactInstanceEventListener
194193
private boolean mUseFallbackBundle = true;
195194
private volatile boolean mInstanceManagerInvalidated = false;
196195

197-
private class ReactContextInitParams {
196+
private static class ReactContextInitParams {
198197
private final JavaScriptExecutorFactory mJsExecutorFactory;
199198
private final JSBundleLoader mJsBundleLoader;
200199

@@ -301,14 +300,11 @@ public static ReactInstanceManagerBuilder builder() {
301300
mDevSupportManager.startInspector();
302301
}
303302

304-
// Using `if (true)` just to prevent tests / lint errors.
305-
if (true) {
306-
// Legacy architecture of React Native is deprecated and can't be initialized anymore.
307-
// More details on:
308-
// https://github.com/react-native-community/discussions-and-proposals/blob/nc/legacy-arch-removal/proposals/0929-legacy-architecture-removal.md
309-
throw new UnsupportedOperationException(
310-
"ReactInstanceManager.createReactContext is unsupported.");
311-
}
303+
// Legacy architecture of React Native is deprecated and can't be initialized anymore.
304+
// More details on:
305+
// https://github.com/react-native-community/discussions-and-proposals/blob/nc/legacy-arch-removal/proposals/0929-legacy-architecture-removal.md
306+
throw new UnsupportedOperationException(
307+
"ReactInstanceManager.createReactContext is unsupported.");
312308
}
313309

314310
private ReactInstanceDevHelper createDevHelperInterface() {
@@ -450,7 +446,6 @@ private void recreateReactContextInBackgroundInner() {
450446
UiThreadUtil.assertOnUiThread();
451447

452448
if (mUseDeveloperSupport && mJSMainModulePath != null) {
453-
final DeveloperSettings devSettings = mDevSupportManager.getDevSettings();
454449
if (!Systrace.isTracing(TRACE_TAG_REACT)) {
455450
if (mBundleLoader == null) {
456451
mDevSupportManager.handleReloadJS();
@@ -1164,6 +1159,7 @@ private void runCreateReactContextOnNewThread(final ReactContextInitParams initP
11641159
try {
11651160
ReactInstanceManager.this.mHasStartedDestroying.wait();
11661161
} catch (InterruptedException e) {
1162+
// Interrupted while waiting for destruction to complete, just retry
11671163
continue;
11681164
}
11691165
}

0 commit comments

Comments
 (0)