From db8afb0f965507d21625ea4ef4cfdd753712f23d Mon Sep 17 00:00:00 2001 From: David Vacca Date: Wed, 5 Mar 2025 12:17:21 -0800 Subject: [PATCH] Annotate NullSafe(LOCAL) for classes in java/com/facebook/react/text (#49772) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49772 Nullsafety scripts and analysis determine it's safe to annotate these classes as NullSafe(LOCAL) changelog: [internal] internal Reviewed By: javache Differential Revision: D70464133 fbshipit-source-id: d3734957dde5b097980fb2c5feb00aa248566bda --- .../com/facebook/react/views/text/ReactRawTextShadowNode.java | 2 ++ .../main/java/com/facebook/react/views/text/TextAttributes.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java index 4c7af8c72e0..e43e43b5ef4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java @@ -8,6 +8,7 @@ package com.facebook.react.views.text; import androidx.annotation.Nullable; +import com.facebook.infer.annotation.Nullsafe; import com.facebook.react.common.annotations.VisibleForTesting; import com.facebook.react.uimanager.ReactShadowNode; import com.facebook.react.uimanager.ReactShadowNodeImpl; @@ -17,6 +18,7 @@ import com.facebook.react.uimanager.annotations.ReactProp; * {@link ReactShadowNode} class for pure raw text node (aka {@code textContent} in terms of DOM). * Raw text node can only have simple string value without any attributes, properties or state. */ +@Nullsafe(Nullsafe.Mode.LOCAL) public class ReactRawTextShadowNode extends ReactShadowNodeImpl { @VisibleForTesting public static final String PROP_TEXT = "text"; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java index de72c0e3914..f1fbcfe9ac5 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java @@ -9,6 +9,7 @@ package com.facebook.react.views.text; import androidx.annotation.NonNull; import com.facebook.common.logging.FLog; +import com.facebook.infer.annotation.Nullsafe; import com.facebook.react.common.ReactConstants; import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.uimanager.ViewDefaults; @@ -20,6 +21,7 @@ import com.facebook.react.uimanager.ViewDefaults; * the rendered aka effective value. For example, to figure out the rendered/effective font size, * you need to take into account the fontSize, maxFontSizeMultiplier, and allowFontScaling props. */ +@Nullsafe(Nullsafe.Mode.LOCAL) public class TextAttributes { // Setting the default to 0 indicates that there is no max. public static final float DEFAULT_MAX_FONT_SIZE_MULTIPLIER = 0.0f;