Skip to content

Commit 23e693a

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Make ReactSoftExceptionLogger internal (facebook#51173)
Summary: This class can be internalized as part of the initiative to reduce the public API surface. I've checked there are [no relevant OSS usages](https://github.com/search?type=code&q=NOT+is%3Afork+NOT+org%3Afacebook+NOT+repo%3Areact-native-tvos%2Freact-native-tvos+NOT+repo%3Anuagoz%2Freact-native+NOT+repo%3A2lambda123%2Freact-native+NOT+repo%3Abeanchips%2Ffacebookreactnative+NOT+repo%3AfabOnReact%2Freact-native-notes+NOT+user%3Ahuntie+NOT+user%3Acortinico+NOT+repo%3AMaxdev18%2Fpowersync_app+NOT+repo%3Acarter-0%2Finstagram-decompiled+NOT+repo%3Am0mosenpai%2Finstadamn+NOT+repo%3AA-Star100%2FA-Star100-AUG2-2024+NOT+repo%3Alclnrd%2Fdetox-scrollview-reproductible+NOT+repo%3ADionisisChytiris%2FWorldWiseTrivia_Main+NOT+repo%3Apast3l%2Fhi2+NOT+repo%3AoneDotpy%2FCaribouQuest+NOT+repo%3Abejayoharen%2Fdailytodo+NOT+repo%3Amolangning%2Freversing-discord+NOT+repo%3AScottPrzy%2Freact-native+NOT+repo%3Agabrieldonadel%2Freact-native-visionos+NOT+repo%3AGabriel2308%2FTestes-Soft+NOT+repo%3Adawnzs03%2FflakyBuild+NOT+repo%3Acga2351%2Fcode+NOT+repo%3Astreeg%2Ftcc+NOT+repo%3Asoftware-mansion-labs%2Freact-native-swiftui+NOT+repo%3Apkcsecurity%2Fdecompiled-lightbulb+com.facebook.react.bridge.ReactSoftExceptionLogger). ## Changelog: [INTERNAL] - Make com.facebook.react.bridge.ReactSoftExceptionLogger internal Pull Request resolved: facebook#51173 Test Plan: ```bash yarn test-android yarn android ``` Reviewed By: rshest Differential Revision: D74368261 Pulled By: arushikesarwani94 fbshipit-source-id: 913d790eb64ffda6bb48ddf69dd5ab996cd363d9
1 parent b2ffd34 commit 23e693a

File tree

2 files changed

+15
-40
lines changed

2 files changed

+15
-40
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,31 +1308,6 @@ public class com/facebook/react/bridge/ReactNoCrashSoftException : java/lang/Run
13081308
public fun <init> (Ljava/lang/Throwable;)V
13091309
}
13101310

1311-
public final class com/facebook/react/bridge/ReactSoftExceptionLogger {
1312-
public static final field INSTANCE Lcom/facebook/react/bridge/ReactSoftExceptionLogger;
1313-
public static final fun addListener (Lcom/facebook/react/bridge/ReactSoftExceptionLogger$ReactSoftExceptionListener;)V
1314-
public static final fun clearListeners ()V
1315-
public static final fun logSoftException (Ljava/lang/String;Ljava/lang/Throwable;)V
1316-
public static final fun logSoftExceptionVerbose (Ljava/lang/String;Ljava/lang/Throwable;)V
1317-
public static final fun removeListener (Lcom/facebook/react/bridge/ReactSoftExceptionLogger$ReactSoftExceptionListener;)V
1318-
}
1319-
1320-
public final class com/facebook/react/bridge/ReactSoftExceptionLogger$Categories {
1321-
public static final field CLIPPING_PROHIBITED_VIEW Ljava/lang/String;
1322-
public static final field INSTANCE Lcom/facebook/react/bridge/ReactSoftExceptionLogger$Categories;
1323-
public static final field RVG_IS_VIEW_CLIPPED Ljava/lang/String;
1324-
public static final field RVG_ON_VIEW_REMOVED Ljava/lang/String;
1325-
public static final field SOFT_ASSERTIONS Ljava/lang/String;
1326-
public static final field SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE Ljava/lang/String;
1327-
}
1328-
1329-
public abstract interface annotation class com/facebook/react/bridge/ReactSoftExceptionLogger$CategoryMode : java/lang/annotation/Annotation {
1330-
}
1331-
1332-
public abstract interface class com/facebook/react/bridge/ReactSoftExceptionLogger$ReactSoftExceptionListener {
1333-
public abstract fun logSoftException (Ljava/lang/String;Ljava/lang/Throwable;)V
1334-
}
1335-
13361311
public abstract interface class com/facebook/react/bridge/ReadableArray {
13371312
public abstract fun getArray (I)Lcom/facebook/react/bridge/ReadableArray;
13381313
public abstract fun getBoolean (I)Z

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ import com.facebook.react.bridge.ReactSoftExceptionLogger.Categories.SURFACE_MOU
1818
import java.util.concurrent.CopyOnWriteArrayList
1919

2020
@DoNotStrip
21-
public object ReactSoftExceptionLogger {
21+
internal object ReactSoftExceptionLogger {
2222
@Retention(AnnotationRetention.SOURCE)
2323
@StringDef(
2424
RVG_IS_VIEW_CLIPPED,
2525
RVG_ON_VIEW_REMOVED,
2626
CLIPPING_PROHIBITED_VIEW,
2727
SOFT_ASSERTIONS,
2828
SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE)
29-
public annotation class CategoryMode
29+
annotation class CategoryMode
3030

3131
/** Constants that listeners can utilize for custom category-based behavior. */
32-
public object Categories {
33-
public const val RVG_IS_VIEW_CLIPPED: String = "ReactViewGroup.isViewClipped"
34-
public const val RVG_ON_VIEW_REMOVED: String = "ReactViewGroup.onViewRemoved"
35-
public const val CLIPPING_PROHIBITED_VIEW: String = "ReactClippingProhibitedView"
36-
public const val SOFT_ASSERTIONS: String = "SoftAssertions"
37-
public const val SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE: String =
32+
object Categories {
33+
const val RVG_IS_VIEW_CLIPPED: String = "ReactViewGroup.isViewClipped"
34+
const val RVG_ON_VIEW_REMOVED: String = "ReactViewGroup.onViewRemoved"
35+
const val CLIPPING_PROHIBITED_VIEW: String = "ReactClippingProhibitedView"
36+
const val SOFT_ASSERTIONS: String = "SoftAssertions"
37+
const val SURFACE_MOUNTING_MANAGER_MISSING_VIEWSTATE: String =
3838
"SurfaceMountingManager:MissingViewState"
3939
}
4040

@@ -44,29 +44,29 @@ public object ReactSoftExceptionLogger {
4444
private val listeners: MutableList<ReactSoftExceptionListener> = CopyOnWriteArrayList()
4545

4646
@JvmStatic
47-
public fun addListener(listener: ReactSoftExceptionListener): Unit {
47+
fun addListener(listener: ReactSoftExceptionListener): Unit {
4848
if (!listeners.contains(listener)) {
4949
listeners.add(listener)
5050
}
5151
}
5252

5353
@JvmStatic
54-
public fun removeListener(listener: ReactSoftExceptionListener): Unit {
54+
fun removeListener(listener: ReactSoftExceptionListener): Unit {
5555
listeners.remove(listener)
5656
}
5757

5858
@JvmStatic
59-
public fun clearListeners(): Unit {
59+
fun clearListeners(): Unit {
6060
listeners.clear()
6161
}
6262

6363
@JvmStatic
64-
public fun logSoftExceptionVerbose(@CategoryMode category: String, cause: Throwable): Unit {
64+
fun logSoftExceptionVerbose(@CategoryMode category: String, cause: Throwable): Unit {
6565
logSoftException("${category}|${cause.javaClass.simpleName}:${cause.message}", cause)
6666
}
6767

6868
@JvmStatic
69-
public fun logSoftException(@CategoryMode category: String, cause: Throwable): Unit {
69+
fun logSoftException(@CategoryMode category: String, cause: Throwable): Unit {
7070
if (!listeners.isEmpty()) {
7171
for (listener in listeners) {
7272
listener.logSoftException(category, cause)
@@ -82,7 +82,7 @@ public object ReactSoftExceptionLogger {
8282
logSoftException(category, ReactNoCrashSoftException(message))
8383
}
8484

85-
public fun interface ReactSoftExceptionListener {
86-
public fun logSoftException(category: String, cause: Throwable)
85+
fun interface ReactSoftExceptionListener {
86+
fun logSoftException(category: String, cause: Throwable)
8787
}
8888
}

0 commit comments

Comments
 (0)