Mark IntBufferBatchMountItem as nullsafe (#44540)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44540

Noticed when running `arc nn`

> Advice xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java:39
> [Class has 0 issues and can be marked Nullsafe] Congrats! `IntBufferBatchMountItem` is free of nullability issues. Mark it `Nullsafe(Nullsafe.Mode.LOCAL)` to prevent regressions.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D57249958

fbshipit-source-id: d38559a3fafae0ad778c19dd85c5da610a650d7c
This commit is contained in:
Nick Gerleman
2024-05-14 00:08:56 -07:00
committed by Facebook GitHub Bot
parent 61887338ea
commit 2cc3ba1f19
3 changed files with 14 additions and 10 deletions
@@ -776,9 +776,12 @@ public class FabricUIManager
@AnyThread
@ThreadConfined(ANY)
private MountItem createIntBufferBatchMountItem(
int rootTag, int[] intBuffer, Object[] objBuffer, int commitNumber) {
int rootTag, @Nullable int[] intBuffer, @Nullable Object[] objBuffer, int commitNumber) {
return MountItemFactory.createIntBufferBatchMountItem(
rootTag, intBuffer, objBuffer, commitNumber);
rootTag,
intBuffer == null ? new int[0] : intBuffer,
objBuffer == null ? new Object[0] : objBuffer,
commitNumber);
}
/**
@@ -11,8 +11,8 @@ import static com.facebook.react.fabric.FabricUIManager.ENABLE_FABRIC_LOGS;
import static com.facebook.react.fabric.FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT;
import static com.facebook.react.fabric.mounting.mountitems.FabricNameComponentMapping.getFabricComponentName;
import androidx.annotation.NonNull;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
@@ -35,6 +35,7 @@ import com.facebook.systrace.Systrace;
* allocations in C++ and JNI round-trips.
*/
@DoNotStrip
@Nullsafe(Nullsafe.Mode.LOCAL)
final class IntBufferBatchMountItem implements BatchMountItem {
static final String TAG = IntBufferBatchMountItem.class.getSimpleName();
@@ -55,8 +56,8 @@ final class IntBufferBatchMountItem implements BatchMountItem {
private final int mSurfaceId;
private final int mCommitNumber;
private final @NonNull int[] mIntBuffer;
private final @NonNull Object[] mObjBuffer;
private final int[] mIntBuffer;
private final Object[] mObjBuffer;
private final int mIntBufferLen;
private final int mObjBufferLen;
@@ -68,8 +69,8 @@ final class IntBufferBatchMountItem implements BatchMountItem {
mIntBuffer = intBuf;
mObjBuffer = objBuf;
mIntBufferLen = mIntBuffer != null ? mIntBuffer.length : 0;
mObjBufferLen = mObjBuffer != null ? mObjBuffer.length : 0;
mIntBufferLen = mIntBuffer.length;
mObjBufferLen = mObjBuffer.length;
}
private void beginMarkers(String reason) {
@@ -91,7 +92,7 @@ final class IntBufferBatchMountItem implements BatchMountItem {
}
@Override
public void execute(@NonNull MountingManager mountingManager) {
public void execute(MountingManager mountingManager) {
SurfaceMountingManager surfaceMountingManager = mountingManager.getSurfaceManager(mSurfaceId);
if (surfaceMountingManager == null) {
FLog.e(
@@ -63,8 +63,8 @@ public object MountItemFactory {
@JvmStatic
public fun createIntBufferBatchMountItem(
surfaceId: Int,
intBuf: IntArray?,
objBuf: Array<Any?>?,
intBuf: IntArray,
objBuf: Array<Any?>,
commitNumber: Int
): MountItem = IntBufferBatchMountItem(surfaceId, intBuf, objBuf, commitNumber)
}