Skip to content

Commit bdfac9c

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Fix multiple lint warnings in NativeViewHierarchyManager (#55499)
Summary: 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
1 parent ad8ac5e commit bdfac9c

1 file changed

Lines changed: 4 additions & 25 deletions

File tree

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

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
package com.facebook.react.uimanager;
99

10+
import android.annotation.SuppressLint;
1011
import android.graphics.Matrix;
1112
import android.graphics.Rect;
1213
import android.graphics.RectF;
@@ -76,6 +77,9 @@ public class NativeViewHierarchyManager {
7677
}
7778

7879
private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
80+
81+
// Debug mode is intentionally disabled (false). To enable, change to just ReactBuildConfig.DEBUG
82+
@SuppressLint("ClownyBooleanExpression")
7983
private final boolean DEBUG_MODE = ReactBuildConfig.DEBUG && false;
8084

8185
private final SparseArray<View> mTagsToViews;
@@ -248,7 +252,6 @@ private void updateInstanceHandle(View viewToUpdate, long instanceHandle) {
248252
viewToUpdate.setTag(R.id.view_tag_instance_handle, instanceHandle);
249253
}
250254

251-
@Nullable
252255
public synchronized long getInstanceHandle(int reactTag) {
253256
View view = mTagsToViews.get(reactTag);
254257
if (view == null) {
@@ -523,18 +526,6 @@ public synchronized void manageChildren(
523526
}
524527
}
525528

526-
private boolean arrayContains(@Nullable int[] array, int ele) {
527-
if (array == null) {
528-
return false;
529-
}
530-
for (int curEle : array) {
531-
if (curEle == ele) {
532-
return true;
533-
}
534-
}
535-
return false;
536-
}
537-
538529
/**
539530
* Simplified version of constructManageChildrenErrorMessage that only deals with adding children
540531
* views
@@ -851,18 +842,6 @@ public synchronized void dispatchCommand(
851842
viewManager.receiveCommand(view, commandId, args);
852843
}
853844

854-
/**
855-
* @return Themed React context for view with a given {@param reactTag} - it gets the context
856-
* directly from the view using {@link View#getContext}.
857-
*/
858-
private ThemedReactContext getReactContextForView(int reactTag) {
859-
View view = mTagsToViews.get(reactTag);
860-
if (view == null) {
861-
throw new JSApplicationIllegalArgumentException("Could not find view with tag " + reactTag);
862-
}
863-
return (ThemedReactContext) view.getContext();
864-
}
865-
866845
public synchronized void sendAccessibilityEvent(int tag, int eventType) {
867846
View view = mTagsToViews.get(tag);
868847
if (view == null) {

0 commit comments

Comments
 (0)