Skip to content

Commit

Permalink
Remove deprecated ReactModuleInfo constructor (#47681)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #47681

These were deprecated back in D49262824, so should be safe to remove now.

Changelog: [Android][Removed] Removed hasConstants constructor from ReactModuleInfo

Reviewed By: mdvacca

Differential Revision: D66127070

fbshipit-source-id: 3bd441c96597598470f16c7770c4dfa4ada563a0
  • Loading branch information
javache authored and facebook-github-bot committed Nov 22, 2024
1 parent bf5c98c commit aec7a66
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 36 deletions.
2 changes: 0 additions & 2 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -2957,11 +2957,9 @@ public abstract interface annotation class com/facebook/react/module/annotations
public final class com/facebook/react/module/model/ReactModuleInfo {
public static final field Companion Lcom/facebook/react/module/model/ReactModuleInfo$Companion;
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZ)V
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZZ)V
public final fun canOverrideExistingModule ()Z
public static final fun classIsTurboModule (Ljava/lang/Class;)Z
public final fun className ()Ljava/lang/String;
public final fun hasConstants ()Z
public final fun isCxxModule ()Z
public final fun isTurboModule ()Z
public final fun name ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,13 @@ import com.facebook.react.turbomodule.core.interfaces.TurboModule
* so Java modules don't have to be instantiated at React Native start up.
*/
public class ReactModuleInfo(
private val _name: String,
private val _className: String,
private val _canOverrideExistingModule: Boolean,
private val _needsEagerInit: Boolean,
@get:JvmName("name") public val name: String,
@get:JvmName("className") public val className: String,
@get:JvmName("canOverrideExistingModule") public val canOverrideExistingModule: Boolean,
@get:JvmName("needsEagerInit") public val needsEagerInit: Boolean,
public val isCxxModule: Boolean,
public val isTurboModule: Boolean
) {

@Deprecated("use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]")
public constructor(
name: String,
className: String,
canOverrideExistingModule: Boolean,
needsEagerInit: Boolean,
@Suppress("UNUSED_PARAMETER") hasConstants: Boolean,
isCxxModule: Boolean,
isTurboModule: Boolean
) : this(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule)

public fun name(): String = _name

public fun className(): String = _className

public fun canOverrideExistingModule(): Boolean = _canOverrideExistingModule

public fun needsEagerInit(): Boolean = _needsEagerInit

@Deprecated("this is hardcoded to return true, regardless if the module has constants or not")
public fun hasConstants(): Boolean = true

public companion object {
/**
* Checks if the passed class is a TurboModule. Useful to populate the parameter [isTurboModule]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class ReactModuleInfoTest {
/* needsEagerInit = */ false,
/* isCxxModule = */ false,
/* isTurboModule = */ false)
assertThat(reactModuleInfo.name()).isEqualTo("name")
assertThat(reactModuleInfo.canOverrideExistingModule()).isFalse()
assertThat(reactModuleInfo.needsEagerInit()).isFalse()
assertThat(reactModuleInfo.name).isEqualTo("name")
assertThat(reactModuleInfo.canOverrideExistingModule).isFalse()
assertThat(reactModuleInfo.needsEagerInit).isFalse()
assertThat(reactModuleInfo.isCxxModule).isFalse()
assertThat(reactModuleInfo.isTurboModule).isFalse()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ internal class RNTesterApplication : Application(), ReactApplication {
ReactModuleInfo(
SampleTurboModule.NAME,
"SampleTurboModule",
_canOverrideExistingModule = false,
_needsEagerInit = false,
canOverrideExistingModule = false,
needsEagerInit = false,
isCxxModule = false,
isTurboModule = true),
SampleLegacyModule.NAME to
ReactModuleInfo(
SampleLegacyModule.NAME,
"SampleLegacyModule",
_canOverrideExistingModule = false,
_needsEagerInit = false,
canOverrideExistingModule = false,
needsEagerInit = false,
isCxxModule = false,
isTurboModule = false))
} else {
Expand Down

0 comments on commit aec7a66

Please sign in to comment.