diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 03b14a6a8f2b..1c1ddf86c852 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -2777,8 +2777,8 @@ public abstract interface class com/facebook/react/fabric/mounting/mountitems/Ba public abstract class com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem : com/facebook/react/fabric/mounting/mountitems/MountItem { public fun ()V - public fun getRetries ()I - public fun incrementRetries ()V + public final fun getRetries ()I + public final fun incrementRetries ()V } public abstract interface class com/facebook/react/fabric/mounting/mountitems/MountItem { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.kt similarity index 87% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.kt index e106d2dbc1d5..d1f62216050a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.kt @@ -5,9 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.common; - -import com.facebook.infer.annotation.Nullsafe; +package com.facebook.react.common /** * Lifecycle state for an Activity. The state right after pause and right before resume are the @@ -23,8 +21,7 @@ *

RESUMED is used when a ReactRootView is rendered on the screen and the user can interact with * it. */ -@Nullsafe(Nullsafe.Mode.LOCAL) -public enum LifecycleState { +public enum class LifecycleState { BEFORE_CREATE, BEFORE_RESUME, RESUMED, diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.kt similarity index 55% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.kt index feedcc4bc2f4..e44050f72fee 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.kt @@ -5,27 +5,22 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.fabric.mounting.mountitems; +package com.facebook.react.fabric.mounting.mountitems -import androidx.annotation.UiThread; -import com.facebook.infer.annotation.Nullsafe; +import androidx.annotation.UiThread /** * This is a common interface for View Command operations. Once we delete the deprecated {@link * DispatchIntCommandMountItem}, we can delete this interface too. It provides a set of common * operations to simplify generic operations on all types of ViewCommands. */ -@Nullsafe(Nullsafe.Mode.LOCAL) -public abstract class DispatchCommandMountItem implements MountItem { - private int mNumRetries = 0; +public abstract class DispatchCommandMountItem : MountItem { + private var numRetries: Int = 0 @UiThread - public void incrementRetries() { - mNumRetries++; + public fun incrementRetries() { + numRetries++ } - @UiThread - public int getRetries() { - return mNumRetries; - } + @UiThread public fun getRetries(): Int = numRetries } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java deleted file mode 100644 index bbfe4400dd0f..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.packagerconnection; - -import androidx.annotation.Nullable; -import com.facebook.common.logging.FLog; -import com.facebook.infer.annotation.Nullsafe; - -@Nullsafe(Nullsafe.Mode.LOCAL) -public abstract class NotificationOnlyHandler implements RequestHandler { - private static final String TAG = JSPackagerClient.class.getSimpleName(); - - public final void onRequest(@Nullable Object params, Responder responder) { - responder.error("Request is not supported"); - FLog.e(TAG, "Request is not supported"); - } - - public abstract void onNotification(@Nullable Object params); -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.kt new file mode 100644 index 000000000000..e4c0822efd49 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.kt @@ -0,0 +1,20 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.packagerconnection + +import com.facebook.common.logging.FLog + +public abstract class NotificationOnlyHandler : RequestHandler { + + override final fun onRequest(params: Any?, responder: Responder) { + responder.error("Request is not supported") + FLog.e(JSPackagerClient::class.java.simpleName, "Request is not supported") + } + + override abstract fun onNotification(params: Any?) +} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.kt similarity index 86% rename from packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java rename to packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.kt index 35d40c382414..7cc3313bc075 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.kt @@ -5,16 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -package com.facebook.react.uimanager; - -import com.facebook.infer.annotation.Nullsafe; +package com.facebook.react.uimanager // Common conditionals: // - `kind == PARENT` checks whether the node can host children in the native tree. // - `kind != NONE` checks whether the node appears in the native tree. -@Nullsafe(Nullsafe.Mode.LOCAL) -public enum NativeKind { +public enum class NativeKind { // Node is in the native hierarchy and the HierarchyOptimizer should assume it can host children // (e.g. because it's a ViewGroup). Note that it's okay if the node doesn't support children. When // the HierarchyOptimizer generates children manipulation commands for that node, the @@ -24,5 +21,5 @@ public enum NativeKind { // because it isn't a ViewGroup). Consequently, its children need to be hosted by an ancestor. LEAF, // Node is not in the native hierarchy. - NONE + NONE, }