Skip to content

Commit

Permalink
Kotlin to 1.9.22 (#42927)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #42927

This bumps Kotlin to 1.9.22 which is the latest in OSS and closer to the version we use inside fbsource.

Turns out that Explicit API mode was not enabled correctly, so I had to go over all the Kotlin classes
and correctly set them to `public` if they were intended to be for public consumption.

I updated some of them to `private` or `internal` but otherwise I've defaulted to `public` which is the default
we have right now.

Changelog:
[Android] [Changed] - Kotlin to 1.9.22

Reviewed By: cipolleschi

Differential Revision: D53576844

fbshipit-source-id: dd8b08ce9bf87f738159f60fd850e3e3bc490ebc
  • Loading branch information
cortinico authored and facebook-github-bot committed Feb 9, 2024
1 parent cadaf26 commit 3c2b2b1
Show file tree
Hide file tree
Showing 69 changed files with 289 additions and 300 deletions.
2 changes: 1 addition & 1 deletion packages/react-native-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ kotlin { jvmToolchain(17) }

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
apiVersion = "1.5"
apiVersion = "1.6"
// See comment above on JDK 11 support
jvmTarget = "11"
allWarningsAsErrors = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gson = "2.8.9"
guava = "31.0.1-jre"
javapoet = "1.13.0"
junit = "4.13.2"
kotlin = "1.8.22"
kotlin = "1.9.22"

[libraries]
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
Expand Down
30 changes: 0 additions & 30 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,6 @@ public final class com/facebook/react/common/mapbuffer/ReadableMapBuffer$Compani
}

public final class com/facebook/react/common/mapbuffer/WritableMapBuffer : com/facebook/react/common/mapbuffer/MapBuffer {
public static final field Companion Lcom/facebook/react/common/mapbuffer/WritableMapBuffer$Companion;
public fun <init> ()V
public fun contains (I)Z
public fun entryAt (I)Lcom/facebook/react/common/mapbuffer/MapBuffer$Entry;
Expand All @@ -1880,9 +1879,6 @@ public final class com/facebook/react/common/mapbuffer/WritableMapBuffer : com/f
public final fun put (IZ)Lcom/facebook/react/common/mapbuffer/WritableMapBuffer;
}

public final class com/facebook/react/common/mapbuffer/WritableMapBuffer$Companion {
}

public class com/facebook/react/common/network/OkHttpCallUtil {
public static fun cancelTag (Lokhttp3/OkHttpClient;Ljava/lang/Object;)V
}
Expand Down Expand Up @@ -1969,7 +1965,6 @@ public abstract class com/facebook/react/defaults/DefaultReactNativeHost : com/f
}

public final class com/facebook/react/defaults/DefaultTurboModuleManagerDelegate : com/facebook/react/ReactPackageTurboModuleManagerDelegate {
public static final field Companion Lcom/facebook/react/defaults/DefaultTurboModuleManagerDelegate$Companion;
public synthetic fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/util/List;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public static final fun initHybrid (Ljava/util/List;)Lcom/facebook/jni/HybridData;
}
Expand All @@ -1981,10 +1976,6 @@ public final class com/facebook/react/defaults/DefaultTurboModuleManagerDelegate
public synthetic fun build (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/util/List;)Lcom/facebook/react/ReactPackageTurboModuleManagerDelegate;
}

public final class com/facebook/react/defaults/DefaultTurboModuleManagerDelegate$Companion {
public final fun initHybrid (Ljava/util/List;)Lcom/facebook/jni/HybridData;
}

public final class com/facebook/react/devsupport/BridgeDevSupportManager : com/facebook/react/devsupport/DevSupportManagerBase {
public fun <init> (Landroid/content/Context;Lcom/facebook/react/devsupport/ReactInstanceDevHelper;Ljava/lang/String;ZLcom/facebook/react/devsupport/interfaces/RedBoxHandler;Lcom/facebook/react/devsupport/interfaces/DevBundleDownloadListener;ILjava/util/Map;Lcom/facebook/react/common/SurfaceDelegateFactory;Lcom/facebook/react/devsupport/interfaces/DevLoadingViewManager;)V
public fun handleReloadJS ()V
Expand Down Expand Up @@ -2505,17 +2496,13 @@ public class com/facebook/react/fabric/DevToolsReactPerfLogger$FabricCommitPoint
}

public final class com/facebook/react/fabric/EmptyReactNativeConfig : com/facebook/react/fabric/ReactNativeConfig {
public static final field Companion Lcom/facebook/react/fabric/EmptyReactNativeConfig$Companion;
public fun <init> ()V
public fun getBool (Ljava/lang/String;)Z
public fun getDouble (Ljava/lang/String;)D
public fun getInt64 (Ljava/lang/String;)J
public fun getString (Ljava/lang/String;)Ljava/lang/String;
}

public final class com/facebook/react/fabric/EmptyReactNativeConfig$Companion {
}

public class com/facebook/react/fabric/FabricComponents {
public fun <init> ()V
public static fun getFabricComponentName (Ljava/lang/String;)Ljava/lang/String;
Expand Down Expand Up @@ -2795,15 +2782,10 @@ public abstract interface class com/facebook/react/interfaces/fabric/SurfaceHand
}

public final class com/facebook/react/jscexecutor/JSCExecutor : com/facebook/react/bridge/JavaScriptExecutor {
public static final field Companion Lcom/facebook/react/jscexecutor/JSCExecutor$Companion;
public fun getName ()Ljava/lang/String;
public static final fun loadLibrary ()V
}

public final class com/facebook/react/jscexecutor/JSCExecutor$Companion {
public final fun loadLibrary ()V
}

public final class com/facebook/react/jscexecutor/JSCExecutorFactory : com/facebook/react/bridge/JavaScriptExecutorFactory {
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
public fun create ()Lcom/facebook/react/bridge/JavaScriptExecutor;
Expand Down Expand Up @@ -3582,13 +3564,9 @@ public abstract class com/facebook/react/perflogger/NativeModulePerfLogger {
}

public abstract class com/facebook/react/runtime/BindingsInstaller {
public static final field Companion Lcom/facebook/react/runtime/BindingsInstaller$Companion;
public fun <init> (Lcom/facebook/jni/HybridData;)V
}

public final class com/facebook/react/runtime/BindingsInstaller$Companion {
}

public class com/facebook/react/runtime/CoreReactPackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider {
public fun <init> ()V
public fun getReactModuleInfos ()Ljava/util/Map;
Expand Down Expand Up @@ -3666,9 +3644,6 @@ public class com/facebook/react/runtime/ReactSurfaceView : com/facebook/react/Re
public fun setIsFabric (Z)V
}

public final class com/facebook/react/runtime/cxxreactpackage/CxxReactPackage$Companion {
}

public final class com/facebook/react/runtime/hermes/HermesInstance : com/facebook/react/runtime/JSRuntimeFactory {
public static final field Companion Lcom/facebook/react/runtime/hermes/HermesInstance$Companion;
public fun <init> ()V
Expand Down Expand Up @@ -6177,7 +6152,6 @@ public final class com/facebook/react/views/popupmenu/PopupMenuSelectionEvent :
public fun <init> (III)V
public fun dispatch (Lcom/facebook/react/uimanager/events/RCTEventEmitter;)V
public fun getEventName ()Ljava/lang/String;
public final fun getItem ()I
}

public final class com/facebook/react/views/popupmenu/PopupMenuSelectionEvent$Companion {
Expand Down Expand Up @@ -7718,10 +7692,6 @@ public final class com/facebook/react/views/view/ReactViewManagerWrapper$Default
public fun updateState (Landroid/view/View;Ljava/lang/Object;Lcom/facebook/react/uimanager/StateWrapper;)Ljava/lang/Object;
}

public final class com/facebook/react/views/view/ReactViewReturnTypeException : java/lang/Exception {
public fun <init> (Ljava/lang/String;Ljava/lang/Throwable;)V
}

public class com/facebook/react/views/view/ViewGroupClickEvent : com/facebook/react/uimanager/events/Event {
public fun <init> (I)V
public fun <init> (II)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ package com.facebook.react
* JavaScriptCore first and fail if it is not available. [.HERMES] will load Hermes first and fail
* if it is not available.
*/
enum class JSEngineResolutionAlgorithm {
public enum class JSEngineResolutionAlgorithm {
JSC,
HERMES
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@

package com.facebook.react

import com.facebook.react.common.annotations.UnstableReactNativeAPI

@OptIn(UnstableReactNativeAPI::class)
/** Interface that represents an instance of a React Native application */
interface ReactApplication {
public interface ReactApplication {
/** Get the default [ReactNativeHost] for this app. */
val reactNativeHost: ReactNativeHost
public val reactNativeHost: ReactNativeHost

/**
* Get the default [ReactHost] for this app. This method will be used by the new architecture of
* react native
*/
val reactHost: ReactHost?
public val reactHost: ReactHost?
get() = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,52 +25,59 @@ import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
*
* The implementation of this interface should be Thread Safe
*/
interface ReactHost {
public interface ReactHost {

/** The current [LifecycleState] for React Host */
val lifecycleState: LifecycleState
public val lifecycleState: LifecycleState

/**
* The current [ReactContext] associated with ReactInstance. It could be nullable if ReactInstance
* hasn't been created.
*/
val currentReactContext: ReactContext?
public val currentReactContext: ReactContext?

// TODO: review if DevSupportManager should be nullable
/** [DevSupportManager] used by this ReactHost */
val devSupportManager: DevSupportManager?
public val devSupportManager: DevSupportManager?

// TODO: review if possible to remove ReactQueueConfiguration
/** [ReactQueueConfiguration] for caller to post jobs in React Native threads */
val reactQueueConfiguration: ReactQueueConfiguration?
public val reactQueueConfiguration: ReactQueueConfiguration?

/** [JSEngineResolutionAlgorithm] used by this host. */
var jsEngineResolutionAlgorithm: JSEngineResolutionAlgorithm?
public var jsEngineResolutionAlgorithm: JSEngineResolutionAlgorithm?

/** To be called when back button is pressed */
fun onBackPressed(): Boolean
public fun onBackPressed(): Boolean

// TODO: review why activity is nullable in all of the lifecycle methods
/** To be called when the host activity is resumed. */
fun onHostResume(activity: Activity?, defaultBackButtonImpl: DefaultHardwareBackBtnHandler?)
public fun onHostResume(
activity: Activity?,
defaultBackButtonImpl: DefaultHardwareBackBtnHandler?
)

/** To be called when the host activity is resumed. */
fun onHostResume(activity: Activity?)
public fun onHostResume(activity: Activity?)

/** To be called when the host activity is paused. */
fun onHostPause(activity: Activity?)
public fun onHostPause(activity: Activity?)

/** To be called when the host activity is paused. */
fun onHostPause()
public fun onHostPause()

/** To be called when the host activity is destroyed. */
fun onHostDestroy()
public fun onHostDestroy()

/** To be called when the host activity is destroyed. */
fun onHostDestroy(activity: Activity?)
public fun onHostDestroy(activity: Activity?)

/** To be called to create and setup an ReactSurface. */
fun createSurface(context: Context, moduleName: String, initialProps: Bundle?): ReactSurface?
public fun createSurface(
context: Context,
moduleName: String,
initialProps: Bundle?
): ReactSurface?

/**
* This function can be used to initialize the ReactInstance in a background thread before a
Expand All @@ -81,7 +88,7 @@ interface ReactHost {
* errors occur during initialization, and will be cancelled if ReactHost.destroy() is called
* before it completes.
*/
fun start(): TaskInterface<Void>
public fun start(): TaskInterface<Void>

/**
* Entrypoint to reload the ReactInstance. If the ReactInstance is destroying, will wait until
Expand All @@ -91,7 +98,7 @@ interface ReactHost {
* button)
* @return A task that completes when React Native reloads
*/
fun reload(reason: String): TaskInterface<Void>
public fun reload(reason: String): TaskInterface<Void>

/**
* Entrypoint to destroy the ReactInstance. If the ReactInstance is reloading, will wait until
Expand All @@ -102,9 +109,9 @@ interface ReactHost {
* be used to log properly the cause of destroy operation.
* @return A task that completes when React Native gets destroyed.
*/
fun destroy(reason: String, ex: Exception?): TaskInterface<Void>
public fun destroy(reason: String, ex: Exception?): TaskInterface<Void>

fun addBeforeDestroyListener(onBeforeDestroy: () -> Unit)
public fun addBeforeDestroyListener(onBeforeDestroy: () -> Unit)

fun removeBeforeDestroyListener(onBeforeDestroy: () -> Unit)
public fun removeBeforeDestroyListener(onBeforeDestroy: () -> Unit)
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ package com.facebook.react
import com.facebook.react.bridge.ReactContext

/** Interface to subscribe for react instance events */
interface ReactInstanceEventListener {
public interface ReactInstanceEventListener {
/**
* Called when the react context is initialized (all modules registered). Always called on the UI
* thread.
*/
fun onReactContextInitialized(context: ReactContext)
public fun onReactContextInitialized(context: ReactContext)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
* in isolation of others part of the new architecture of React Native.
*/
@DeprecatedInNewArchitecture
fun interface UIManagerProvider {
public fun interface UIManagerProvider {

/* Provides a {@link com.facebook.react.bridge.UIManager} for the context received as a parameter. */
fun createUIManager(context: ReactApplicationContext): UIManager?
public fun createUIManager(context: ReactApplicationContext): UIManager?
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ package com.facebook.react.common.annotations
*/
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class DeprecatedInNewArchitecture(val message: String = "")
public annotation class DeprecatedInNewArchitecture(val message: String = "")
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ package com.facebook.react.common.annotations
"This API is provided only for React Native frameworks and not intended for general users. " +
"This API can change between minor versions in alignment with React Native frameworks " +
"and won't be considered a breaking change.")
annotation class FrameworkAPI
public annotation class FrameworkAPI
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ package com.facebook.react.common.annotations
/** This API is stable and is likely not to change in the New Architecture of React Native. */
@Retention(AnnotationRetention.SOURCE)
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
annotation class StableReactNativeAPI
public annotation class StableReactNativeAPI
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ package com.facebook.react.common.annotations
@RequiresOptIn(
level = RequiresOptIn.Level.ERROR,
message = "This API is experimental and is likely to change or to be removed in the future")
annotation class UnstableReactNativeAPI
public annotation class UnstableReactNativeAPI
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ package com.facebook.react.common.annotations
* Annotates a method that should have restricted visibility but it's required to be public for use
* in test code only.
*/
annotation class VisibleForTesting
public annotation class VisibleForTesting
Loading

0 comments on commit 3c2b2b1

Please sign in to comment.