Skip to content

Commit f880bfd

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Kotlin: clean up redundant visibility modifiers (1/2) (facebook#51960)
Summary: Static code analysis shows that there are several redundant visibility modifiers across the codebase. These are most likely remnants after making different classes internal. ## Changelog: [INTERNAL] - Kotlin: clean up redundant visibility modifiers Pull Request resolved: facebook#51960 Test Plan: ```sh yarn android yarn test-android ``` Reviewed By: javache Differential Revision: D76503015 Pulled By: cortinico fbshipit-source-id: e60e7aa141fc35ca2fd76335fbee791c86589e4e
1 parent fed27e7 commit f880bfd

File tree

18 files changed

+73
-74
lines changed

18 files changed

+73
-74
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public class NativeAnimatedModule(reactContext: ReactApplicationContext?) :
111111
private var valueMap: Array<BatchExecutionOpCodes>? = null
112112

113113
@JvmStatic
114-
public fun fromId(id: Int): BatchExecutionOpCodes {
114+
fun fromId(id: Int): BatchExecutionOpCodes {
115115
val valueMapNonnull: Array<BatchExecutionOpCodes> =
116116
valueMap ?: BatchExecutionOpCodes.values()
117117
if (valueMap == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class JavaScriptModuleRegistry {
6767
return name ?: getJSModuleName(moduleInterface).also { name = it }
6868
}
6969

70-
public override fun invoke(proxy: Any, method: Method, args: Array<Any?>?): Any? {
70+
override fun invoke(proxy: Any, method: Method, args: Array<Any?>?): Any? {
7171
val jsArgs = if (args != null) Arguments.fromJavaArgs(args) else WritableNativeArray()
7272
catalystInstance.callFunction(getJSModuleName(), method.name, jsArgs)
7373
return null

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevMenuModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal class DevMenuModule(
4040
devSupportManager.setHotModuleReplacementEnabled(enabled)
4141
}
4242

43-
public companion object {
44-
public const val NAME: String = NativeDevMenuSpec.NAME
43+
companion object {
44+
const val NAME: String = NativeDevMenuSpec.NAME
4545
}
4646
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ internal class DeviceInfoModule(reactContext: ReactApplicationContext) :
7474
reactApplicationContext.removeLifecycleEventListener(this)
7575
}
7676

77-
public companion object {
78-
public const val NAME: String = NativeDeviceInfoSpec.NAME
77+
companion object {
78+
const val NAME: String = NativeDeviceInfoSpec.NAME
7979
}
8080
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ internal class BridgelessCatalystInstance(private val reactHost: ReactHostImpl)
8484
throw UnsupportedOperationException("Unimplemented method 'destroy'")
8585
}
8686

87-
public override val isDestroyed: Boolean
87+
override val isDestroyed: Boolean
8888
get() = throw UnsupportedOperationException("Unimplemented method 'isDestroyed'")
8989

9090
@VisibleForTesting
@@ -96,16 +96,16 @@ internal class BridgelessCatalystInstance(private val reactHost: ReactHostImpl)
9696
reactHost.currentReactContext?.getJSModule(jsInterface)
9797

9898
@get:Deprecated("Deprecated in Java")
99-
public override val javaScriptContextHolder: JavaScriptContextHolder
99+
override val javaScriptContextHolder: JavaScriptContextHolder
100100
get() = reactHost.javaScriptContextHolder!!
101101

102102
@Suppress("INAPPLICABLE_JVM_NAME")
103103
@get:Deprecated("Deprecated in Java")
104104
@get:JvmName("getJSCallInvokerHolder") // This is needed to keep backward compatibility
105-
public override val jsCallInvokerHolder: CallInvokerHolder
105+
override val jsCallInvokerHolder: CallInvokerHolder
106106
get() = reactHost.jsCallInvokerHolder!!
107107

108-
public override val nativeMethodCallInvokerHolder: NativeMethodCallInvokerHolder
108+
override val nativeMethodCallInvokerHolder: NativeMethodCallInvokerHolder
109109
get() =
110110
throw UnsupportedOperationException(
111111
"Unimplemented method 'getNativeMethodCallInvokerHolder'")
@@ -119,23 +119,23 @@ internal class BridgelessCatalystInstance(private val reactHost: ReactHostImpl)
119119
override fun getNativeModule(moduleName: String): NativeModule? =
120120
reactHost.getNativeModule(moduleName)
121121

122-
public override val nativeModules: Collection<NativeModule>
122+
override val nativeModules: Collection<NativeModule>
123123
get() = reactHost.nativeModules
124124

125-
public override val reactQueueConfiguration: ReactQueueConfiguration
125+
override val reactQueueConfiguration: ReactQueueConfiguration
126126
get() = reactHost.reactQueueConfiguration!!
127127

128-
public override val runtimeExecutor: RuntimeExecutor?
128+
override val runtimeExecutor: RuntimeExecutor?
129129
get() = reactHost.runtimeExecutor
130130

131-
public override val runtimeScheduler: RuntimeScheduler
131+
override val runtimeScheduler: RuntimeScheduler
132132
get() = throw UnsupportedOperationException("Unimplemented method 'getRuntimeScheduler'")
133133

134-
public override fun extendNativeModules(modules: NativeModuleRegistry) {
134+
override fun extendNativeModules(modules: NativeModuleRegistry) {
135135
throw UnsupportedOperationException("Unimplemented method 'extendNativeModules'")
136136
}
137137

138-
public override val sourceURL: String
138+
override val sourceURL: String
139139
get() = throw UnsupportedOperationException("Unimplemented method 'getSourceURL'")
140140

141141
override fun addBridgeIdleDebugListener(listener: NotThreadSafeBridgeIdleDebugListener) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal class BridgelessReactContext(context: Context, private val reactHost: R
5757

5858
override fun getSourceURL(): String? = sourceURLRef.get()
5959

60-
public fun setSourceURL(sourceURL: String?) {
60+
fun setSourceURL(sourceURL: String?) {
6161
sourceURLRef.set(sourceURL)
6262
}
6363

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal class FabricEventDispatcher(
5959
eventEmitter.registerFabricEventEmitter(fabricEventEmitter)
6060
}
6161

62-
public override fun dispatchEvent(event: Event<*>) {
62+
override fun dispatchEvent(event: Event<*>) {
6363
for (listener in listeners) {
6464
listener.onEventDispatch(event)
6565
}
@@ -100,7 +100,7 @@ internal class FabricEventDispatcher(
100100
}
101101
}
102102

103-
public override fun dispatchAllEvents() {
103+
override fun dispatchAllEvents() {
104104
scheduleDispatchOfBatchedEvents()
105105
}
106106

@@ -116,46 +116,46 @@ internal class FabricEventDispatcher(
116116
}
117117

118118
/** Add a listener to this EventDispatcher. */
119-
public override fun addListener(listener: EventDispatcherListener) {
119+
override fun addListener(listener: EventDispatcherListener) {
120120
listeners.add(listener)
121121
}
122122

123123
/** Remove a listener from this EventDispatcher. */
124-
public override fun removeListener(listener: EventDispatcherListener) {
124+
override fun removeListener(listener: EventDispatcherListener) {
125125
listeners.remove(listener)
126126
}
127127

128-
public override fun addBatchEventDispatchedListener(listener: BatchEventDispatchedListener) {
128+
override fun addBatchEventDispatchedListener(listener: BatchEventDispatchedListener) {
129129
postEventDispatchListeners.add(listener)
130130
}
131131

132-
public override fun removeBatchEventDispatchedListener(listener: BatchEventDispatchedListener) {
132+
override fun removeBatchEventDispatchedListener(listener: BatchEventDispatchedListener) {
133133
postEventDispatchListeners.remove(listener)
134134
}
135135

136-
public override fun onHostResume() {
136+
override fun onHostResume() {
137137
scheduleDispatchOfBatchedEvents()
138138
if (!ReactNativeFeatureFlags.useOptimizedEventBatchingOnAndroid()) {
139139
currentFrameCallback.resume()
140140
}
141141
}
142142

143-
public override fun onHostPause() {
143+
override fun onHostPause() {
144144
cancelDispatchOfBatchedEvents()
145145
}
146146

147-
public override fun onHostDestroy() {
147+
override fun onHostDestroy() {
148148
cancelDispatchOfBatchedEvents()
149149
}
150150

151-
public fun invalidate() {
151+
fun invalidate() {
152152
eventEmitter.registerFabricEventEmitter(null)
153153

154154
UiThreadUtil.runOnUiThread { cancelDispatchOfBatchedEvents() }
155155
}
156156

157157
@Deprecated("Private API, should only be used when the concrete implementation is known.")
158-
public override fun onCatalystInstanceDestroyed() {
158+
override fun onCatalystInstanceDestroyed() {
159159
invalidate()
160160
}
161161

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutUpdateAnimation.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import com.facebook.react.common.annotations.internal.LegacyArchitectureLogger
2121
@LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
2222
internal class LayoutUpdateAnimation : AbstractLayoutAnimation() {
2323

24-
internal override fun isValid(): Boolean = durationMs > 0
24+
override fun isValid(): Boolean = durationMs > 0
2525

26-
internal override fun createAnimationImpl(
26+
override fun createAnimationImpl(
2727
view: View,
2828
x: Int,
2929
y: Int,

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class ColorStop(var color: Int? = null, val position: LengthPercentage?
2626
internal class ProcessedColorStop(var color: Int? = null, val position: Float? = null)
2727

2828
internal object ColorStopUtils {
29-
public fun getFixedColorStops(
29+
fun getFixedColorStops(
3030
colorStops: List<ColorStop>,
3131
gradientLineLength: Float
3232
): List<ProcessedColorStop> {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/Gradient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ package com.facebook.react.uimanager.style
1010
import android.graphics.Shader
1111

1212
internal interface Gradient {
13-
public fun getShader(width: Float, height: Float): Shader
13+
fun getShader(width: Float, height: Float): Shader
1414
}

0 commit comments

Comments
 (0)