mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix multiple lint warnings in NativeViewHierarchyManager (#55499)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55499 Fixed multiple lint warnings in NativeViewHierarchyManager.java: 1. ClownyBooleanExpression: Added SuppressLint for intentionally disabled DEBUG_MODE (ReactBuildConfig.DEBUG && false). This pattern is used to easily enable debug mode by changing to just ReactBuildConfig.DEBUG. 2. NullableAnnotationShouldNotAddToPrimitiveTypes: Removed Nullable from getInstanceHandle() which returns a primitive long. Primitives can't be null; this method throws exceptions instead of returning null. 3. NotInvokedPrivateMethod: Removed unused private methods arrayContains() and getReactContextForView() which were dead code. changelog: [internal] internal Reviewed By: alanleedev Differential Revision: D91992935 fbshipit-source-id: 367f0d9a6b3f5bbbf10d61c0e5ba02071eb60ee8
This commit is contained in:
1 parent
a03536398b
commit
19faf7e5cf
1 file changed
+4
-25
+4
-25
@@ -7,6 +7,7 @@
|
||||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
@@ -76,6 +77,9 @@ public class NativeViewHierarchyManager {
|
||||
}
|
||||
|
||||
private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
|
||||
|
||||
// Debug mode is intentionally disabled (false). To enable, change to just ReactBuildConfig.DEBUG
|
||||
@SuppressLint("ClownyBooleanExpression")
|
||||
private final boolean DEBUG_MODE = ReactBuildConfig.DEBUG && false;
|
||||
|
||||
private final SparseArray<View> mTagsToViews;
|
||||
@@ -248,7 +252,6 @@ public class NativeViewHierarchyManager {
|
||||
viewToUpdate.setTag(R.id.view_tag_instance_handle, instanceHandle);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public synchronized long getInstanceHandle(int reactTag) {
|
||||
View view = mTagsToViews.get(reactTag);
|
||||
if (view == null) {
|
||||
@@ -523,18 +526,6 @@ public class NativeViewHierarchyManager {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean arrayContains(@Nullable int[] array, int ele) {
|
||||
if (array == null) {
|
||||
return false;
|
||||
}
|
||||
for (int curEle : array) {
|
||||
if (curEle == ele) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplified version of constructManageChildrenErrorMessage that only deals with adding children
|
||||
* views
|
||||
@@ -851,18 +842,6 @@ public class NativeViewHierarchyManager {
|
||||
viewManager.receiveCommand(view, commandId, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Themed React context for view with a given {@param reactTag} - it gets the context
|
||||
* directly from the view using {@link View#getContext}.
|
||||
*/
|
||||
private ThemedReactContext getReactContextForView(int reactTag) {
|
||||
View view = mTagsToViews.get(reactTag);
|
||||
if (view == null) {
|
||||
throw new JSApplicationIllegalArgumentException("Could not find view with tag " + reactTag);
|
||||
}
|
||||
return (ThemedReactContext) view.getContext();
|
||||
}
|
||||
|
||||
public synchronized void sendAccessibilityEvent(int tag, int eventType) {
|
||||
View view = mTagsToViews.get(tag);
|
||||
if (view == null) {
|
||||
|
||||
Reference in new issue
Block a user