Skip to content

Commit 6757e54

Browse files
javachemeta-codesync[bot]
authored andcommitted
Mark private static fields as final in ReactHorizontalScrollView (#54343)
Summary: Pull Request resolved: #54343 Fixed NotWrittenPrivateField lint warnings in ReactHorizontalScrollView.java by marking three private static fields as final: - DEBUG_MODE: Changed from `private static boolean` to `private static final boolean` - TAG: Changed from `private static String` to `private static final String` - NO_SCROLL_POSITION: Changed from `private static int` to `private static final int` These fields are initialized once and never modified, making them compile-time constants. Marking them as final follows Java best practices and prevents potential issues with Redex code optimization. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D85904890 fbshipit-source-id: f83a19392a2418d8415936421f1e021316643056
1 parent 3ff4ab2 commit 6757e54

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
8383
HasSmoothScroll,
8484
VirtualViewContainer {
8585

86-
private static boolean DEBUG_MODE = false && ReactBuildConfig.DEBUG;
87-
private static String TAG = ReactHorizontalScrollView.class.getSimpleName();
86+
private static final boolean DEBUG_MODE = false && ReactBuildConfig.DEBUG;
87+
private static final String TAG = ReactHorizontalScrollView.class.getSimpleName();
8888

89-
private static int NO_SCROLL_POSITION = Integer.MIN_VALUE;
89+
private static final int NO_SCROLL_POSITION = Integer.MIN_VALUE;
9090

9191
private static @Nullable Field sScrollerField;
9292
private static boolean sTriedToGetScrollerField = false;

0 commit comments

Comments
 (0)