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
@@ -1,50 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CONVERT_CONSTANTS_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.CONVERT_CONSTANTS_START;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.GET_CONSTANTS_END;
|
||||
import static com.facebook.react.bridge.ReactMarkerConstants.GET_CONSTANTS_START;
|
||||
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
|
||||
|
||||
/**
|
||||
* This is part of the glue which wraps a java BaseJavaModule in a C++
|
||||
* NativeModule. This could all be in C++, but it's android-specific
|
||||
* initialization code, and writing it this way is easier to read and means
|
||||
* fewer JNI calls.
|
||||
*/
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import com.facebook.systrace.SystraceMessage;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This is part of the glue which wraps a java BaseJavaModule in a C++ NativeModule. This could all
|
||||
* be in C++, but it's android-specific initialization code, and writing it this way is easier to
|
||||
* read and means fewer JNI calls.
|
||||
*/
|
||||
@DoNotStrip
|
||||
public class JavaModuleWrapper {
|
||||
@DoNotStrip
|
||||
public class MethodDescriptor {
|
||||
@DoNotStrip
|
||||
Method method;
|
||||
@DoNotStrip
|
||||
String signature;
|
||||
@DoNotStrip
|
||||
String name;
|
||||
@DoNotStrip
|
||||
String type;
|
||||
@DoNotStrip Method method;
|
||||
@DoNotStrip String signature;
|
||||
@DoNotStrip String name;
|
||||
@DoNotStrip String type;
|
||||
}
|
||||
|
||||
private final JSInstance mJSInstance;
|
||||
@@ -93,10 +84,11 @@ public class JavaModuleWrapper {
|
||||
// We do not support method overloading since js sees a function as an object regardless
|
||||
// of number of params.
|
||||
throw new IllegalArgumentException(
|
||||
"Java Module " + getName() + " method name already registered: " + methodName);
|
||||
"Java Module " + getName() + " method name already registered: " + methodName);
|
||||
}
|
||||
MethodDescriptor md = new MethodDescriptor();
|
||||
JavaMethodWrapper method = new JavaMethodWrapper(this, targetMethod, annotation.isBlockingSynchronousMethod());
|
||||
JavaMethodWrapper method =
|
||||
new JavaMethodWrapper(this, targetMethod, annotation.isBlockingSynchronousMethod());
|
||||
md.name = methodName;
|
||||
md.type = method.getType();
|
||||
if (md.type == BaseJavaModule.METHOD_TYPE_SYNC) {
|
||||
@@ -126,8 +118,8 @@ public class JavaModuleWrapper {
|
||||
|
||||
final String moduleName = getName();
|
||||
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "JavaModuleWrapper.getConstants")
|
||||
.arg("moduleName", moduleName)
|
||||
.flush();
|
||||
.arg("moduleName", moduleName)
|
||||
.flush();
|
||||
ReactMarker.logMarker(GET_CONSTANTS_START, moduleName);
|
||||
|
||||
BaseJavaModule baseJavaModule = getModule();
|
||||
|
||||
Reference in New Issue
Block a user