fix nullsafe FIXMEs for ReactTextViewManager.java and mark nullsafe

Summary:
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made ReactTextViewManager.java nullsafe

Reviewed By: javache

Differential Revision: D72460124

fbshipit-source-id: a75705ac4ab486ccaa9162dee5bfd8cae77967c7
This commit is contained in:
Gijs Weterings
2025-04-09 09:07:30 -07:00
committed by Facebook GitHub Bot
parent e03607fa5f
commit 1929ebd00e
2 changed files with 5 additions and 5 deletions
@@ -13,6 +13,7 @@ import android.text.Spannable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.R;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.annotations.VisibleForTesting;
@@ -35,6 +36,7 @@ import java.util.Map;
* Concrete class for {@link ReactTextAnchorViewManager} which represents view managers of anchor
* {@code <Text>} nodes.
*/
@Nullsafe(Nullsafe.Mode.LOCAL)
@ReactModule(name = ReactTextViewManager.REACT_CLASS)
public class ReactTextViewManager
extends ReactTextAnchorViewManager<ReactTextView, ReactTextShadowNode>
@@ -143,14 +145,13 @@ public class ReactTextViewManager
}
@Override
public Object updateState(
public @Nullable Object updateState(
ReactTextView view, ReactStylesDiffMap props, StateWrapper stateWrapper) {
try (SystraceSection s = new SystraceSection("ReactTextViewManager.updateState")) {
MapBuffer stateMapBuffer = stateWrapper.getStateDataMapBuffer();
if (stateMapBuffer != null) {
return getReactTextUpdate(view, props, stateMapBuffer);
} else {
// NULLSAFE_FIXME[Return Not Nullable]
return null;
}
}
@@ -225,7 +226,6 @@ public class ReactTextViewManager
widthMode,
height,
heightMode,
// NULLSAFE_FIXME[Parameter Not Nullable]
mReactTextViewManagerCallback,
attachmentsPositions);
}
@@ -502,7 +502,7 @@ public class TextLayoutManager {
MapBuffer paragraphAttributes,
float width,
float height,
ReactTextViewManagerCallback reactTextViewManagerCallback) {
@Nullable ReactTextViewManagerCallback reactTextViewManagerCallback) {
Spannable text =
getOrCreateSpannableForText(context, attributedString, reactTextViewManagerCallback);
@@ -666,7 +666,7 @@ public class TextLayoutManager {
YogaMeasureMode widthYogaMeasureMode,
float height,
YogaMeasureMode heightYogaMeasureMode,
ReactTextViewManagerCallback reactTextViewManagerCallback,
@Nullable ReactTextViewManagerCallback reactTextViewManagerCallback,
@Nullable float[] attachmentsPositions) {
// TODO(5578671): Handle text direction (see View#getTextDirectionHeuristic)
Layout layout =