mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
committed by
Facebook Github Bot
parent
61e95e5cbf
commit
6c0f73b322
@@ -28,9 +28,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Builder class for {@link ReactInstanceManager}
|
||||
*/
|
||||
/** Builder class for {@link ReactInstanceManager} */
|
||||
public class ReactInstanceManagerBuilder {
|
||||
|
||||
private final List<ReactPackage> mPackages = new ArrayList<>();
|
||||
@@ -55,37 +53,31 @@ public class ReactInstanceManagerBuilder {
|
||||
private @Nullable JSIModulePackage mJSIModulesPackage;
|
||||
private @Nullable Map<String, RequestHandler> mCustomPackagerCommandHandlers;
|
||||
|
||||
/* package protected */ ReactInstanceManagerBuilder() {
|
||||
}
|
||||
/* package protected */ ReactInstanceManagerBuilder() {}
|
||||
|
||||
/**
|
||||
* Sets a provider of {@link UIImplementation}.
|
||||
* Uses default provider if null is passed.
|
||||
*/
|
||||
/** Sets a provider of {@link UIImplementation}. Uses default provider if null is passed. */
|
||||
public ReactInstanceManagerBuilder setUIImplementationProvider(
|
||||
@Nullable UIImplementationProvider uiImplementationProvider) {
|
||||
@Nullable UIImplementationProvider uiImplementationProvider) {
|
||||
mUIImplementationProvider = uiImplementationProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setJSIModulesPackage(
|
||||
@Nullable JSIModulePackage jsiModulePackage) {
|
||||
@Nullable JSIModulePackage jsiModulePackage) {
|
||||
mJSIModulesPackage = jsiModulePackage;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory for desired implementation of JavaScriptExecutor.
|
||||
*/
|
||||
/** Factory for desired implementation of JavaScriptExecutor. */
|
||||
public ReactInstanceManagerBuilder setJavaScriptExecutorFactory(
|
||||
@Nullable JavaScriptExecutorFactory javaScriptExecutorFactory) {
|
||||
@Nullable JavaScriptExecutorFactory javaScriptExecutorFactory) {
|
||||
mJavaScriptExecutorFactory = javaScriptExecutorFactory;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the JS bundle file to be loaded from application's raw assets.
|
||||
* Example: {@code "index.android.js"}
|
||||
* Name of the JS bundle file to be loaded from application's raw assets. Example: {@code
|
||||
* "index.android.js"}
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setBundleAssetName(String bundleAssetName) {
|
||||
mJSBundleAssetUrl = (bundleAssetName == null ? null : "assets://" + bundleAssetName);
|
||||
@@ -96,7 +88,7 @@ public class ReactInstanceManagerBuilder {
|
||||
/**
|
||||
* Path to the JS bundle file to be loaded from the file system.
|
||||
*
|
||||
* Example: {@code "assets://index.android.js" or "/sdcard/main.jsbundle"}
|
||||
* <p>Example: {@code "assets://index.android.js" or "/sdcard/main.jsbundle"}
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setJSBundleFile(String jsBundleFile) {
|
||||
if (jsBundleFile.startsWith("assets://")) {
|
||||
@@ -108,10 +100,10 @@ public class ReactInstanceManagerBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Bundle loader to use when setting up JS environment. This supersedes
|
||||
* prior invocations of {@link setJSBundleFile} and {@link setBundleAssetName}.
|
||||
* Bundle loader to use when setting up JS environment. This supersedes prior invocations of
|
||||
* {@link setJSBundleFile} and {@link setBundleAssetName}.
|
||||
*
|
||||
* Example: {@code JSBundleLoader.createFileLoader(application, bundleFile)}
|
||||
* <p>Example: {@code JSBundleLoader.createFileLoader(application, bundleFile)}
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setJSBundleLoader(JSBundleLoader jsBundleLoader) {
|
||||
mJSBundleLoader = jsBundleLoader;
|
||||
@@ -120,12 +112,9 @@ public class ReactInstanceManagerBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Path to your app's main module on the packager server. This is used when
|
||||
* reloading JS during development. All paths are relative to the root folder
|
||||
* the packager is serving files from.
|
||||
* Examples:
|
||||
* {@code "index.android"} or
|
||||
* {@code "subdirectory/index.android"}
|
||||
* Path to your app's main module on the packager server. This is used when reloading JS during
|
||||
* development. All paths are relative to the root folder the packager is serving files from.
|
||||
* Examples: {@code "index.android"} or {@code "subdirectory/index.android"}
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setJSMainModulePath(String jsMainModulePath) {
|
||||
mJSMainModulePath = jsMainModulePath;
|
||||
@@ -143,14 +132,12 @@ public class ReactInstanceManagerBuilder {
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setBridgeIdleDebugListener(
|
||||
NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener) {
|
||||
NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener) {
|
||||
mBridgeIdleDebugListener = bridgeIdleDebugListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required. This must be your {@code Application} instance.
|
||||
*/
|
||||
/** Required. This must be your {@code Application} instance. */
|
||||
public ReactInstanceManagerBuilder setApplication(Application application) {
|
||||
mApplication = application;
|
||||
return this;
|
||||
@@ -162,15 +149,15 @@ public class ReactInstanceManagerBuilder {
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setDefaultHardwareBackBtnHandler(
|
||||
DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler) {
|
||||
DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler) {
|
||||
mDefaultHardwareBackBtnHandler = defaultHardwareBackBtnHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* When {@code true}, developer options such as JS reloading and debugging are enabled.
|
||||
* Note you still have to call {@link #showDevOptionsDialog} to show the dev menu,
|
||||
* e.g. when the device Menu button is pressed.
|
||||
* When {@code true}, developer options such as JS reloading and debugging are enabled. Note you
|
||||
* still have to call {@link #showDevOptionsDialog} to show the dev menu, e.g. when the device
|
||||
* Menu button is pressed.
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setUseDeveloperSupport(boolean useDeveloperSupport) {
|
||||
mUseDeveloperSupport = useDeveloperSupport;
|
||||
@@ -182,18 +169,18 @@ public class ReactInstanceManagerBuilder {
|
||||
* creation time, we wouldn't expect an onResume call until we get an onPause call.
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setInitialLifecycleState(
|
||||
LifecycleState initialLifecycleState) {
|
||||
LifecycleState initialLifecycleState) {
|
||||
mInitialLifecycleState = initialLifecycleState;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the exception handler for all native module calls. If not set, the default
|
||||
* {@link DevSupportManager} will be used, which shows a redbox in dev mode and rethrows
|
||||
* (crashes the app) in prod mode.
|
||||
* Set the exception handler for all native module calls. If not set, the default {@link
|
||||
* DevSupportManager} will be used, which shows a redbox in dev mode and rethrows (crashes the
|
||||
* app) in prod mode.
|
||||
*/
|
||||
public ReactInstanceManagerBuilder setNativeModuleCallExceptionHandler(
|
||||
NativeModuleCallExceptionHandler handler) {
|
||||
NativeModuleCallExceptionHandler handler) {
|
||||
mNativeModuleCallExceptionHandler = handler;
|
||||
return this;
|
||||
}
|
||||
@@ -209,7 +196,7 @@ public class ReactInstanceManagerBuilder {
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setDevBundleDownloadListener(
|
||||
@Nullable DevBundleDownloadListener listener) {
|
||||
@Nullable DevBundleDownloadListener listener) {
|
||||
mDevBundleDownloadListener = listener;
|
||||
return this;
|
||||
}
|
||||
@@ -232,33 +219,32 @@ public class ReactInstanceManagerBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new {@link ReactInstanceManager}.
|
||||
* Before calling {@code build}, the following must be called:
|
||||
* Instantiates a new {@link ReactInstanceManager}. Before calling {@code build}, the following
|
||||
* must be called:
|
||||
*
|
||||
* <ul>
|
||||
* <li> {@link #setApplication}
|
||||
* <li> {@link #setCurrentActivity} if the activity has already resumed
|
||||
* <li> {@link #setDefaultHardwareBackBtnHandler} if the activity has already resumed
|
||||
* <li> {@link #setJSBundleFile} or {@link #setJSMainModulePath}
|
||||
* <li>{@link #setApplication}
|
||||
* <li>{@link #setCurrentActivity} if the activity has already resumed
|
||||
* <li>{@link #setDefaultHardwareBackBtnHandler} if the activity has already resumed
|
||||
* <li>{@link #setJSBundleFile} or {@link #setJSMainModulePath}
|
||||
* </ul>
|
||||
*/
|
||||
public ReactInstanceManager build() {
|
||||
Assertions.assertNotNull(
|
||||
mApplication,
|
||||
"Application property has not been set with this builder");
|
||||
mApplication, "Application property has not been set with this builder");
|
||||
|
||||
if (mInitialLifecycleState == LifecycleState.RESUMED) {
|
||||
Assertions.assertNotNull(
|
||||
mCurrentActivity,
|
||||
"Activity needs to be set if initial lifecycle state is resumed");
|
||||
mCurrentActivity, "Activity needs to be set if initial lifecycle state is resumed");
|
||||
}
|
||||
|
||||
Assertions.assertCondition(
|
||||
mUseDeveloperSupport || mJSBundleAssetUrl != null || mJSBundleLoader != null,
|
||||
"JS Bundle File or Asset URL has to be provided when dev support is disabled");
|
||||
mUseDeveloperSupport || mJSBundleAssetUrl != null || mJSBundleLoader != null,
|
||||
"JS Bundle File or Asset URL has to be provided when dev support is disabled");
|
||||
|
||||
Assertions.assertCondition(
|
||||
mJSMainModulePath != null || mJSBundleAssetUrl != null || mJSBundleLoader != null,
|
||||
"Either MainModulePath or JS Bundle File needs to be provided");
|
||||
mJSMainModulePath != null || mJSBundleAssetUrl != null || mJSBundleLoader != null,
|
||||
"Either MainModulePath or JS Bundle File needs to be provided");
|
||||
|
||||
if (mUIImplementationProvider == null) {
|
||||
// create default UIImplementationProvider if the provided one is null.
|
||||
|
||||
Reference in New Issue
Block a user