Remove all the redundant public visibility modifier (#49532)

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

I've done a pass with Android Studio and removed automatically all the `public` modifier
that are not really needed.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D69857731

fbshipit-source-id: 5098a3454a66e5f1eb58ccf07006558cba360066
This commit is contained in:
Nicola Corti
2025-02-19 17:40:14 -08:00
committed by Facebook GitHub Bot
parent fefa17aa37
commit fc325cfee8
18 changed files with 56 additions and 84 deletions
@@ -19,7 +19,7 @@ internal object ReactBridge {
@JvmStatic
@Synchronized
public fun staticInit() {
fun staticInit() {
if (_didInit) {
return
}
@@ -35,14 +35,14 @@ internal object ReactBridge {
}
@JvmStatic
public val loadStartTime: Long
val loadStartTime: Long
get() = _loadStartTime
@JvmStatic
public val loadEndTime: Long
val loadEndTime: Long
get() = _loadEndTime
@JvmStatic
public val initialized: Boolean
val initialized: Boolean
@JvmName("isInitialized") get() = _didInit
}
@@ -86,7 +86,7 @@ public open class ReadableNativeArray protected constructor() : NativeArray(), R
private companion object {
@get:JvmStatic
@get:JvmName("getJNIPassCounter")
public var jniPassCounter: Int = 0
var jniPassCounter: Int = 0
private set
}
}
@@ -179,7 +179,7 @@ public open class ReadableNativeMap protected constructor() : NativeMap(), Reada
private companion object {
@get:JvmStatic
@get:JvmName("getJNIPassCounter")
public var jniPassCounter: Int = 0
var jniPassCounter: Int = 0
private set
}
}
@@ -15,11 +15,11 @@ internal object AndroidChoreographerProvider : ChoreographerProvider {
private class AndroidChoreographer : ChoreographerProvider.Choreographer {
private val instance: android.view.Choreographer = android.view.Choreographer.getInstance()
public override fun postFrameCallback(callback: android.view.Choreographer.FrameCallback) {
override fun postFrameCallback(callback: android.view.Choreographer.FrameCallback) {
instance.postFrameCallback(callback)
}
public override fun removeFrameCallback(callback: android.view.Choreographer.FrameCallback) {
override fun removeFrameCallback(callback: android.view.Choreographer.FrameCallback) {
instance.removeFrameCallback(callback)
}
}
@@ -17,7 +17,7 @@ internal object BlobCollector {
}
@JvmStatic
public fun install(reactContext: ReactContext, blobModule: BlobModule) {
fun install(reactContext: ReactContext, blobModule: BlobModule) {
reactContext.runOnJSQueueThread {
val jsContext: JavaScriptContextHolder? = reactContext.getJavaScriptContextHolder()
// When debugging in chrome the JS context is not available.
@@ -91,9 +91,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
this.imagePipeline.fetchDecodedImage(request, this.callerContext)
val dataSubscriber: DataSubscriber<CloseableReference<CloseableImage>> =
object : BaseDataSubscriber<CloseableReference<CloseableImage>>() {
protected override fun onNewResultImpl(
dataSource: DataSource<CloseableReference<CloseableImage>>
) {
override fun onNewResultImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
if (!dataSource.isFinished) {
return
}
@@ -115,9 +113,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
}
}
protected override fun onFailureImpl(
dataSource: DataSource<CloseableReference<CloseableImage>>
) {
override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
promise.reject(ERROR_GET_SIZE_FAILURE, dataSource.failureCause)
}
}
@@ -151,9 +147,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
this.imagePipeline.fetchDecodedImage(request, this.callerContext)
val dataSubscriber: DataSubscriber<CloseableReference<CloseableImage>> =
object : BaseDataSubscriber<CloseableReference<CloseableImage>>() {
protected override fun onNewResultImpl(
dataSource: DataSource<CloseableReference<CloseableImage>>
) {
override fun onNewResultImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
if (!dataSource.isFinished) {
return
}
@@ -175,9 +169,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
}
}
protected override fun onFailureImpl(
dataSource: DataSource<CloseableReference<CloseableImage>>
) {
override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
promise.reject(ERROR_GET_SIZE_FAILURE, dataSource.failureCause)
}
}
@@ -208,7 +200,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
this.imagePipeline.prefetchToDiskCache(request, this.callerContext)
val prefetchSubscriber =
object : BaseDataSubscriber<Void?>() {
protected override fun onNewResultImpl(dataSource: DataSource<Void?>) {
override fun onNewResultImpl(dataSource: DataSource<Void?>) {
if (!dataSource.isFinished) {
return
}
@@ -222,7 +214,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
}
}
protected override fun onFailureImpl(dataSource: DataSource<Void?>) {
override fun onFailureImpl(dataSource: DataSource<Void?>) {
try {
removeRequest(requestId)
promise.reject(ERROR_PREFETCH_FAILURE, dataSource.failureCause)
@@ -245,7 +237,7 @@ public class ImageLoaderModule : NativeImageLoaderAndroidSpec, LifecycleEventLis
// perform cache interrogation in async task as disk cache checks are expensive
@Suppress("DEPRECATION", "StaticFieldLeak")
object : GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
protected override fun doInBackgroundGuarded(vararg params: Void) {
override fun doInBackgroundGuarded(vararg params: Void) {
val result: WritableMap = Arguments.createMap()
val imagePipeline: ImagePipeline = this@ImageLoaderModule.imagePipeline
for (i in 0 until uris.size()) {
@@ -78,7 +78,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
callbacks.put(
requestCode,
object : Callback {
public override operator fun invoke(vararg args: Any?) {
override operator fun invoke(vararg args: Any?) {
val results = args[0] as IntArray
if (results.size > 0 && results[0] == PackageManager.PERMISSION_GRANTED) {
promise.resolve(GRANTED)
@@ -125,7 +125,7 @@ public class PermissionsModule(reactContext: ReactApplicationContext?) :
callbacks.put(
requestCode,
object : Callback {
public override operator fun invoke(vararg args: Any?) {
override operator fun invoke(vararg args: Any?) {
val results = args[0] as IntArray
val callbackActivity = args[1] as PermissionAwareActivity
for (j in permissionsToCheck.indices) {
@@ -18,6 +18,5 @@ internal object ComponentNameResolverBinding {
SoLoader.loadLibrary("uimanagerjni")
}
@JvmStatic
public external fun install(runtimeExecutor: RuntimeExecutor, componentNameResolver: Any)
@JvmStatic external fun install(runtimeExecutor: RuntimeExecutor, componentNameResolver: Any)
}
@@ -25,7 +25,7 @@ import kotlin.math.sin
internal object FilterHelper {
@JvmStatic
public fun parseFilters(filters: ReadableArray?): RenderEffect? {
fun parseFilters(filters: ReadableArray?): RenderEffect? {
filters ?: return null
var chainedEffects: RenderEffect? = null
for (i in 0 until filters.size()) {
@@ -53,7 +53,7 @@ internal object FilterHelper {
}
@JvmStatic
public fun parseColorMatrixFilters(filters: ReadableArray?): ColorMatrixColorFilter? {
fun parseColorMatrixFilters(filters: ReadableArray?): ColorMatrixColorFilter? {
filters ?: return null
// New ColorMatrix objects represent the identity matrix
val resultColorMatrix = ColorMatrix()
@@ -82,7 +82,7 @@ internal object FilterHelper {
}
@JvmStatic
public fun isOnlyColorMatrixFilters(filters: ReadableArray?): Boolean {
fun isOnlyColorMatrixFilters(filters: ReadableArray?): Boolean {
if (filters == null || filters.size() == 0) {
return false
}
@@ -98,7 +98,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#blurEquivalent
public fun createBlurEffect(sigma: Float, chainedEffects: RenderEffect? = null): RenderEffect? {
fun createBlurEffect(sigma: Float, chainedEffects: RenderEffect? = null): RenderEffect? {
if (sigma <= 0.5) {
return null
}
@@ -112,10 +112,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#brightnessEquivalent
public fun createBrightnessEffect(
amount: Float,
chainedEffects: RenderEffect? = null
): RenderEffect {
fun createBrightnessEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createBrightnessColorMatrix(amount), chainedEffects)
}
@@ -126,15 +123,12 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#opacityEquivalent
public fun createOpacityEffect(
amount: Float,
chainedEffects: RenderEffect? = null
): RenderEffect {
fun createOpacityEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createOpacityColorMatrix(amount), chainedEffects)
}
// https://www.w3.org/TR/filter-effects-1/#dropshadowEquivalent
public fun createDropShadowEffect(
fun createDropShadowEffect(
offsetX: Float,
offsetY: Float,
blurRadius: Float,
@@ -176,7 +170,7 @@ internal object FilterHelper {
return RenderEffect.createBlendModeEffect(blurEffect, identity, BlendMode.SRC_OVER)
}
public fun parseAndCreateDropShadowEffect(
fun parseAndCreateDropShadowEffect(
filterValues: ReadableMap,
chainedEffects: RenderEffect? = null
): RenderEffect {
@@ -191,17 +185,14 @@ internal object FilterHelper {
return createDropShadowEffect(offsetX, offsetY, radius, color, chainedEffects)
}
public fun createOpacityColorMatrix(amount: Float): ColorMatrix {
fun createOpacityColorMatrix(amount: Float): ColorMatrix {
val matrix = ColorMatrix()
matrix.setScale(1f, 1f, 1f, amount)
return matrix
}
// https://www.w3.org/TR/filter-effects-1/#contrastEquivalent
public fun createContrastEffect(
amount: Float,
chainedEffects: RenderEffect? = null
): RenderEffect {
fun createContrastEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createContrastColorMatrix(amount), chainedEffects)
}
@@ -234,10 +225,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#grayscaleEquivalent
public fun createGrayscaleEffect(
amount: Float,
chainedEffects: RenderEffect? = null
): RenderEffect {
fun createGrayscaleEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createGrayscaleColorMatrix(amount), chainedEffects)
}
@@ -268,7 +256,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#sepiaEquivalent
public fun createSepiaEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
fun createSepiaEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createSepiaColorMatrix(amount), chainedEffects)
}
@@ -299,10 +287,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#saturateEquivalent
public fun createSaturateEffect(
amount: Float,
chainedEffects: RenderEffect? = null
): RenderEffect {
fun createSaturateEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createSaturateColorMatrix(amount), chainedEffects)
}
@@ -313,10 +298,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#huerotateEquivalent
public fun createHueRotateEffect(
amount: Float,
chainedEffects: RenderEffect? = null
): RenderEffect {
fun createHueRotateEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createHueRotateColorMatrix(amount), chainedEffects)
}
@@ -349,7 +331,7 @@ internal object FilterHelper {
}
// https://www.w3.org/TR/filter-effects-1/#invertEquivalent
public fun createInvertEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
fun createInvertEffect(amount: Float, chainedEffects: RenderEffect? = null): RenderEffect {
return createColorMatrixEffect(createInvertColorMatrix(amount), chainedEffects)
}
@@ -20,7 +20,7 @@ internal object UIConstantsProviderBinding {
}
@JvmStatic
public external fun install(
external fun install(
runtimeExecutor: RuntimeExecutor,
defaultEventTypesProvider: DefaultEventTypesProvider,
viewManagerConstantsProvider: ConstantsForViewManagerProvider,
@@ -28,20 +28,20 @@ internal object UIConstantsProviderBinding {
)
@DoNotStripAny
public interface DefaultEventTypesProvider {
interface DefaultEventTypesProvider {
/* Returns UIManager's constants. */
public fun getDefaultEventTypes(): NativeMap
fun getDefaultEventTypes(): NativeMap
}
@DoNotStripAny
public interface ConstantsForViewManagerProvider {
interface ConstantsForViewManagerProvider {
/* Returns UIManager's constants. */
public fun getConstantsForViewManager(viewManagerName: String): NativeMap?
fun getConstantsForViewManager(viewManagerName: String): NativeMap?
}
@DoNotStripAny
public interface ConstantsProvider {
interface ConstantsProvider {
/* Returns UIManager's constants. */
public fun getConstants(): NativeMap
fun getConstants(): NativeMap
}
}
@@ -201,15 +201,15 @@ public open class FabricEventDispatcher(reactContext: ReactApplicationContext) :
}
}
public fun stop() {
fun stop() {
shouldStop = true
}
public fun resume() {
fun resume() {
shouldStop = false
}
public fun maybeDispatchBatchedEvents() {
fun maybeDispatchBatchedEvents() {
if (!isFrameCallbackDispatchScheduled) {
isFrameCallbackDispatchScheduled = true
dispatchBatchedEvents()
@@ -221,7 +221,7 @@ public open class FabricEventDispatcher(reactContext: ReactApplicationContext) :
.postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, currentFrameCallback)
}
public fun maybeScheduleDispatchOfBatchedEvents() {
fun maybeScheduleDispatchOfBatchedEvents() {
if (isFrameCallbackDispatchScheduled) {
return
}
@@ -19,7 +19,7 @@ internal enum class AnimatedPropertyType {
companion object {
@JvmStatic
public fun fromString(name: String): AnimatedPropertyType {
fun fromString(name: String): AnimatedPropertyType {
return when (name) {
"opacity" -> OPACITY
"scaleX" -> SCALE_X
@@ -25,7 +25,7 @@ internal value class BorderColors(
@ColorInt val edgeColors: Array<Int?> = arrayOfNulls<Int?>(LogicalEdge.values().size)
) {
public fun resolve(layoutDirection: Int, context: Context): ColorEdges {
fun resolve(layoutDirection: Int, context: Context): ColorEdges {
return when (layoutDirection) {
LayoutDirection.LTR ->
ColorEdges(
@@ -45,11 +45,11 @@ internal data class BorderRadiusStyle(
var endStart: LengthPercentage? = null,
var endEnd: LengthPercentage? = null
) {
public constructor(properties: List<Pair<BorderRadiusProp, LengthPercentage>>) : this() {
constructor(properties: List<Pair<BorderRadiusProp, LengthPercentage>>) : this() {
properties.forEach { (k, v) -> set(k, v) }
}
public fun set(property: BorderRadiusProp, value: LengthPercentage?) {
fun set(property: BorderRadiusProp, value: LengthPercentage?) {
when (property) {
BorderRadiusProp.BORDER_RADIUS -> uniform = value
BorderRadiusProp.BORDER_TOP_LEFT_RADIUS -> topLeft = value
@@ -67,7 +67,7 @@ internal data class BorderRadiusStyle(
}
}
public fun get(property: BorderRadiusProp): LengthPercentage? {
fun get(property: BorderRadiusProp): LengthPercentage? {
return when (property) {
BorderRadiusProp.BORDER_RADIUS -> uniform
BorderRadiusProp.BORDER_TOP_LEFT_RADIUS -> topLeft
@@ -85,7 +85,7 @@ internal data class BorderRadiusStyle(
}
}
public fun hasRoundedBorders(): Boolean {
fun hasRoundedBorders(): Boolean {
return uniform != null ||
topLeft != null ||
topRight != null ||
@@ -101,7 +101,7 @@ internal data class BorderRadiusStyle(
endEnd != null
}
public fun resolve(
fun resolve(
layoutDirection: Int,
context: Context,
width: Float,
@@ -30,7 +30,7 @@ internal class ReactHorizontalScrollContainerLegacyView(context: Context) :
}
}
protected override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
if (isRTL) {
// When the layout direction is RTL, we expect Yoga to give us a layout
// that extends off the screen to the left so we re-center it with left=0
@@ -476,8 +476,7 @@ public object ReactScrollViewHelper {
public val stateWrapper: StateWrapper?
}
private class OverScrollerDurationGetter internal constructor(context: Context?) :
OverScroller(context) {
private class OverScrollerDurationGetter(context: Context?) : OverScroller(context) {
// This is the default in AOSP, hardcoded in OverScroller.java.
private var currentScrollAnimationDuration = 250
val scrollAnimationDuration: Int
@@ -40,6 +40,6 @@ public class ReactRawTextManager : ViewManager<View, ReactRawTextShadowNode>() {
}
internal companion object {
public const val REACT_CLASS: String = "RCTRawText"
const val REACT_CLASS: String = "RCTRawText"
}
}
@@ -17,5 +17,5 @@ internal abstract class ReactTextInlineImageShadowNode : LayoutShadowNode() {
* Build a [TextInlineImageSpan] from this node. This will be added to the TextView in place of
* this node.
*/
public abstract fun buildInlineImageSpan(): TextInlineImageSpan
abstract fun buildInlineImageSpan(): TextInlineImageSpan
}