Skip to content

Commit

Permalink
Remove all the redundant public visibility modifier (facebook#49532)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#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
  • Loading branch information
cortinico authored and facebook-github-bot committed Feb 19, 2025
1 parent e804683 commit 2fae1eb
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal object ReactBridge {

@JvmStatic
@Synchronized
public fun staticInit() {
fun staticInit() {
if (_didInit) {
return
}
Expand All @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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)
Expand All @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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)
}

Expand All @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ internal object UIConstantsProviderBinding {
}

@JvmStatic
public external fun install(
external fun install(
runtimeExecutor: RuntimeExecutor,
defaultEventTypesProvider: DefaultEventTypesProvider,
viewManagerConstantsProvider: ConstantsForViewManagerProvider,
constantsProvider: ConstantsProvider
)

@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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -221,7 +221,7 @@ public open class FabricEventDispatcher(reactContext: ReactApplicationContext) :
.postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, currentFrameCallback)
}

public fun maybeScheduleDispatchOfBatchedEvents() {
fun maybeScheduleDispatchOfBatchedEvents() {
if (isFrameCallbackDispatchScheduled) {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading

0 comments on commit 2fae1eb

Please sign in to comment.