diff --git a/.cursor/rules/api.mdc b/.cursor/rules/api.mdc index 9435bc2590f..14711824262 100644 --- a/.cursor/rules/api.mdc +++ b/.cursor/rules/api.mdc @@ -63,15 +63,13 @@ When adding a new method that users can call (e.g. a new scope operation), these 7. `NoOpScope` — no-op stub for `IScope` 8. `NoOpScopes` — no-op stub for `IScopes` 9. `ScopesAdapter` — delegates to `Sentry` static API -10. `HubAdapter` — deprecated bridge from old `IHub` API -11. `HubScopesWrapper` — wraps `IScopes` as `IHub` ### Serialization (if the data is sent to Sentry) -12. Add serialization/deserialization in the relevant data class or create a new one implementing `JsonSerializable` and `JsonDeserializer` +10. Add serialization/deserialization in the relevant data class or create a new one implementing `JsonSerializable` and `JsonDeserializer` ### Tests -13. Write tests for all implementations, especially `Scope`, `Scopes`, `SentryTest`, and any new data classes -14. No-op classes typically don't need separate tests unless they have non-trivial logic +11. Write tests for all implementations, especially `Scope`, `Scopes`, `SentryTest`, and any new data classes +12. No-op classes typically don't need separate tests unless they have non-trivial logic ## Protocol / Data Model Classes diff --git a/.cursor/rules/scopes.mdc b/.cursor/rules/scopes.mdc index 6da9baeec39..1a4e8767ef3 100644 --- a/.cursor/rules/scopes.mdc +++ b/.cursor/rules/scopes.mdc @@ -14,8 +14,8 @@ Data itself is stored on `Scope` instances. ## `Hub` Up until major version 7 of the Java SDK the `IHub` interface was a central part of the SDK. -In major version 8 we replaced the `IHub` interface with `IScopes`. `IHub` has been deprecated. -While there is some bridging code in place to allow for easier migration, we are planning to remove it in an upcoming major. +In major version 8 we replaced the `IHub` interface with `IScopes` and deprecated the Hub compatibility APIs. +Those compatibility APIs were removed in major version 9. ## Scope Types diff --git a/CHANGELOG.md b/CHANGELOG.md index 5476f6d9831..d45a51bd9b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - Recover Android 17 `MemoryLimiter` app exits recorded as `ApplicationExitInfo.REASON_MEMORY_LIMITER` ([#6174](https://github.com/getsentry/sentry-java/pull/6174)) +### Internal + +- Remove deprecated Hub compatibility APIs in favor of `IScopes` and `Scopes` ([#6223](https://github.com/getsentry/sentry-java/pull/6223)) + ## 8.58.0 ### Features diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt index 725a5a61122..805fce9019e 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt @@ -353,7 +353,7 @@ class SentryAndroidTest { fun `init starts session replay if app is in foreground`() { initSentryWithForegroundImportance(true) { _ -> Shadows.shadowOf(Looper.getMainLooper()).idle() - assertTrue(Sentry.getCurrentHub().options.replayController.isRecording()) + assertTrue(Sentry.getCurrentScopes().options.replayController.isRecording()) } } @@ -362,7 +362,7 @@ class SentryAndroidTest { fun `init does not start session replay if the app is in background`() { initSentryWithForegroundImportance(false) { _ -> Shadows.shadowOf(Looper.getMainLooper()).idle() - assertFalse(Sentry.getCurrentHub().options.replayController.isRecording()) + assertFalse(Sentry.getCurrentScopes().options.replayController.isRecording()) } } diff --git a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt index 1b98cd59c7b..eab3ace0dd1 100644 --- a/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt +++ b/sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt @@ -36,7 +36,8 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) val outboxPath = - Sentry.getCurrentHub().options.outboxPath ?: throw RuntimeException("Outbox path is not set.") + Sentry.getCurrentScopes().options.outboxPath + ?: throw RuntimeException("Outbox path is not set.") requestPermissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean -> diff --git a/sentry-graphql-core/api/sentry-graphql-core.api b/sentry-graphql-core/api/sentry-graphql-core.api index 7b63e2270d4..3b68787e8b6 100644 --- a/sentry-graphql-core/api/sentry-graphql-core.api +++ b/sentry-graphql-core/api/sentry-graphql-core.api @@ -11,7 +11,6 @@ public final class io/sentry/graphql/ExceptionReporter { public final class io/sentry/graphql/ExceptionReporter$ExceptionDetails { public fun (Lio/sentry/IScopes;Lgraphql/execution/instrumentation/parameters/InstrumentationExecutionParameters;Z)V public fun (Lio/sentry/IScopes;Lgraphql/schema/DataFetchingEnvironment;Z)V - public fun getHub ()Lio/sentry/IScopes; public fun getQuery ()Ljava/lang/String; public fun getScopes ()Lio/sentry/IScopes; public fun getVariables ()Ljava/util/Map; diff --git a/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java b/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java index 4330a49e22d..86eac63fc43 100644 --- a/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java +++ b/sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java @@ -163,14 +163,6 @@ public boolean isSubscription() { return isSubscription; } - /** - * @deprecated please use {@link ExceptionDetails#getScopes()} instead. - */ - @Deprecated - public @NotNull IScopes getHub() { - return scopes; - } - public @NotNull IScopes getScopes() { return scopes; } diff --git a/sentry-spring-7/api/sentry-spring-7.api b/sentry-spring-7/api/sentry-spring-7.api index c9250b550fd..530f3e84317 100644 --- a/sentry-spring-7/api/sentry-spring-7.api +++ b/sentry-spring-7/api/sentry-spring-7.api @@ -376,7 +376,6 @@ public final class io/sentry/spring7/tracing/TransactionNameWithSource { } public abstract class io/sentry/spring7/webflux/AbstractSentryWebFilter : org/springframework/web/server/WebFilter { - public static final field SENTRY_HUB_KEY Ljava/lang/String; public static final field SENTRY_SCOPES_KEY Ljava/lang/String; public fun (Lio/sentry/IScopes;)V protected fun doFinally (Lorg/springframework/web/server/ServerWebExchange;Lio/sentry/IScopes;Lio/sentry/ITransaction;)V diff --git a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java index 4dd05110bbf..488d0ab4816 100644 --- a/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java +++ b/sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java @@ -37,11 +37,6 @@ public abstract class AbstractSentryWebFilter implements WebFilter { private final @NotNull SentryRequestResolver sentryRequestResolver; public static final String SENTRY_SCOPES_KEY = "sentry-scopes"; - /** - * @deprecated please use {@link AbstractSentryWebFilter#SENTRY_SCOPES_KEY} instead. - */ - @Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY; - private static final String TRANSACTION_OP = "http.server"; public AbstractSentryWebFilter(final @NotNull IScopes scopes) { diff --git a/sentry-spring-jakarta/api/sentry-spring-jakarta.api b/sentry-spring-jakarta/api/sentry-spring-jakarta.api index 24b9af7e14b..64db0c01b04 100644 --- a/sentry-spring-jakarta/api/sentry-spring-jakarta.api +++ b/sentry-spring-jakarta/api/sentry-spring-jakarta.api @@ -376,7 +376,6 @@ public final class io/sentry/spring/jakarta/tracing/TransactionNameWithSource { } public abstract class io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter : org/springframework/web/server/WebFilter { - public static final field SENTRY_HUB_KEY Ljava/lang/String; public static final field SENTRY_SCOPES_KEY Ljava/lang/String; public fun (Lio/sentry/IScopes;)V protected fun doFinally (Lorg/springframework/web/server/ServerWebExchange;Lio/sentry/IScopes;Lio/sentry/ITransaction;)V diff --git a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java index 84af5a708e0..da7be16d9af 100644 --- a/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java +++ b/sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java @@ -37,11 +37,6 @@ public abstract class AbstractSentryWebFilter implements WebFilter { private final @NotNull SentryRequestResolver sentryRequestResolver; public static final String SENTRY_SCOPES_KEY = "sentry-scopes"; - /** - * @deprecated please use {@link AbstractSentryWebFilter#SENTRY_SCOPES_KEY} instead. - */ - @Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY; - private static final String TRANSACTION_OP = "http.server"; public AbstractSentryWebFilter(final @NotNull IScopes scopes) { diff --git a/sentry-spring/api/sentry-spring.api b/sentry-spring/api/sentry-spring.api index 4e1bea84288..79c00c4c33f 100644 --- a/sentry-spring/api/sentry-spring.api +++ b/sentry-spring/api/sentry-spring.api @@ -383,7 +383,6 @@ public final class io/sentry/spring/webflux/SentryWebExceptionHandler : org/spri } public final class io/sentry/spring/webflux/SentryWebFilter : org/springframework/web/server/WebFilter { - public static final field SENTRY_HUB_KEY Ljava/lang/String; public static final field SENTRY_SCOPES_KEY Ljava/lang/String; public fun (Lio/sentry/IScopes;)V public fun filter (Lorg/springframework/web/server/ServerWebExchange;Lorg/springframework/web/server/WebFilterChain;)Lreactor/core/publisher/Mono; diff --git a/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java b/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java index 30d1152b88a..36e431dc124 100644 --- a/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java +++ b/sentry-spring/src/main/java/io/sentry/spring/webflux/SentryWebFilter.java @@ -37,11 +37,6 @@ public final class SentryWebFilter implements WebFilter { public static final String SENTRY_SCOPES_KEY = "sentry-scopes"; - /** - * @deprecated please use {@link SentryWebFilter#SENTRY_SCOPES_KEY} instead. - */ - @Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY; - private static final String TRANSACTION_OP = "http.server"; private static final String TRACE_ORIGIN = "auto.spring.webflux"; diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 53452c4c3b9..008db683091 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -714,161 +714,6 @@ public final class io/sentry/HttpStatusCodeRange { public fun isInRange (I)Z } -public final class io/sentry/HubAdapter : io/sentry/IHub { - public fun addBreadcrumb (Lio/sentry/Breadcrumb;)V - public fun addBreadcrumb (Lio/sentry/Breadcrumb;Lio/sentry/Hint;)V - public fun addFeatureFlag (Ljava/lang/String;Ljava/lang/Boolean;)V - public fun bindClient (Lio/sentry/ISentryClient;)V - public fun captureCheckIn (Lio/sentry/CheckIn;)Lio/sentry/protocol/SentryId; - public fun captureEnvelope (Lio/sentry/SentryEnvelope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureException (Ljava/lang/Throwable;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureException (Ljava/lang/Throwable;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureFeedback (Lio/sentry/protocol/Feedback;)Lio/sentry/protocol/SentryId; - public fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;)Lio/sentry/protocol/SentryId; - public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureProfileChunk (Lio/sentry/ProfileChunk;)Lio/sentry/protocol/SentryId; - public fun captureReplay (Lio/sentry/SentryReplayEvent;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; - public fun captureUserFeedback (Lio/sentry/UserFeedback;)V - public fun clearBreadcrumbs ()V - public fun clone ()Lio/sentry/IHub; - public synthetic fun clone ()Ljava/lang/Object; - public fun close ()V - public fun close (Z)V - public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V - public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; - public fun endSession ()V - public fun feedback ()Lio/sentry/IFeedbackApi; - public fun flush (J)V - public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; - public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; - public fun forkedScopes (Ljava/lang/String;)Lio/sentry/IScopes; - public fun getBaggage ()Lio/sentry/BaggageHeader; - public fun getGlobalScope ()Lio/sentry/IScope; - public static fun getInstance ()Lio/sentry/HubAdapter; - public fun getIsolationScope ()Lio/sentry/IScope; - public fun getLastEventId ()Lio/sentry/protocol/SentryId; - public fun getOptions ()Lio/sentry/SentryOptions; - public fun getParentScopes ()Lio/sentry/IScopes; - public fun getRateLimiter ()Lio/sentry/transport/RateLimiter; - public fun getScope ()Lio/sentry/IScope; - public fun getSpan ()Lio/sentry/ISpan; - public fun getTraceparent ()Lio/sentry/SentryTraceHeader; - public fun getTransaction ()Lio/sentry/ITransaction; - public fun isAncestorOf (Lio/sentry/IScopes;)Z - public fun isCrashedLastRun ()Ljava/lang/Boolean; - public fun isEnabled ()Z - public fun isHealthy ()Z - public fun logger ()Lio/sentry/logger/ILoggerApi; - public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; - public fun metrics ()Lio/sentry/metrics/IMetricsApi; - public fun popScope ()V - public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; - public fun pushScope ()Lio/sentry/ISentryLifecycleToken; - public fun removeAttribute (Ljava/lang/String;)V - public fun removeExtra (Ljava/lang/String;)V - public fun removeTag (Ljava/lang/String;)V - public fun reportFullyDisplayed ()V - public fun setActiveSpan (Lio/sentry/ISpan;)V - public fun setAttribute (Lio/sentry/SentryAttribute;)V - public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V - public fun setAttributes (Lio/sentry/SentryAttributes;)V - public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V - public fun setFingerprint (Ljava/util/List;)V - public fun setLevel (Lio/sentry/SentryLevel;)V - public fun setSpanContext (Ljava/lang/Throwable;Lio/sentry/ISpan;Ljava/lang/String;)V - public fun setTag (Ljava/lang/String;Ljava/lang/String;)V - public fun setTransaction (Ljava/lang/String;)V - public fun setUser (Lio/sentry/protocol/User;)V - public fun startProfiler ()V - public fun startSession ()V - public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction; - public fun stopProfiler ()V - public fun withIsolationScope (Lio/sentry/ScopeCallback;)V - public fun withScope (Lio/sentry/ScopeCallback;)V -} - -public final class io/sentry/HubScopesWrapper : io/sentry/IHub { - public fun (Lio/sentry/IScopes;)V - public fun addBreadcrumb (Lio/sentry/Breadcrumb;)V - public fun addBreadcrumb (Lio/sentry/Breadcrumb;Lio/sentry/Hint;)V - public fun addFeatureFlag (Ljava/lang/String;Ljava/lang/Boolean;)V - public fun bindClient (Lio/sentry/ISentryClient;)V - public fun captureCheckIn (Lio/sentry/CheckIn;)Lio/sentry/protocol/SentryId; - public fun captureEnvelope (Lio/sentry/SentryEnvelope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureException (Ljava/lang/Throwable;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureException (Ljava/lang/Throwable;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;)Lio/sentry/protocol/SentryId; - public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureProfileChunk (Lio/sentry/ProfileChunk;)Lio/sentry/protocol/SentryId; - public fun captureReplay (Lio/sentry/SentryReplayEvent;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; - public fun captureUserFeedback (Lio/sentry/UserFeedback;)V - public fun clearBreadcrumbs ()V - public fun clone ()Lio/sentry/IHub; - public synthetic fun clone ()Ljava/lang/Object; - public fun close ()V - public fun close (Z)V - public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V - public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; - public fun endSession ()V - public fun feedback ()Lio/sentry/IFeedbackApi; - public fun flush (J)V - public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; - public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; - public fun forkedScopes (Ljava/lang/String;)Lio/sentry/IScopes; - public fun getBaggage ()Lio/sentry/BaggageHeader; - public fun getGlobalScope ()Lio/sentry/IScope; - public fun getIsolationScope ()Lio/sentry/IScope; - public fun getLastEventId ()Lio/sentry/protocol/SentryId; - public fun getOptions ()Lio/sentry/SentryOptions; - public fun getParentScopes ()Lio/sentry/IScopes; - public fun getRateLimiter ()Lio/sentry/transport/RateLimiter; - public fun getScope ()Lio/sentry/IScope; - public fun getScopes ()Lio/sentry/IScopes; - public fun getSpan ()Lio/sentry/ISpan; - public fun getTraceparent ()Lio/sentry/SentryTraceHeader; - public fun getTransaction ()Lio/sentry/ITransaction; - public fun isAncestorOf (Lio/sentry/IScopes;)Z - public fun isCrashedLastRun ()Ljava/lang/Boolean; - public fun isEnabled ()Z - public fun isHealthy ()Z - public fun logger ()Lio/sentry/logger/ILoggerApi; - public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; - public fun metrics ()Lio/sentry/metrics/IMetricsApi; - public fun popScope ()V - public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; - public fun pushScope ()Lio/sentry/ISentryLifecycleToken; - public fun removeAttribute (Ljava/lang/String;)V - public fun removeExtra (Ljava/lang/String;)V - public fun removeTag (Ljava/lang/String;)V - public fun reportFullyDisplayed ()V - public fun setActiveSpan (Lio/sentry/ISpan;)V - public fun setAttribute (Lio/sentry/SentryAttribute;)V - public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V - public fun setAttributes (Lio/sentry/SentryAttributes;)V - public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V - public fun setFingerprint (Ljava/util/List;)V - public fun setLevel (Lio/sentry/SentryLevel;)V - public fun setSpanContext (Ljava/lang/Throwable;Lio/sentry/ISpan;Ljava/lang/String;)V - public fun setTag (Ljava/lang/String;Ljava/lang/String;)V - public fun setTransaction (Ljava/lang/String;)V - public fun setUser (Lio/sentry/protocol/User;)V - public fun startProfiler ()V - public fun startSession ()V - public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction; - public fun stopProfiler ()V - public fun withIsolationScope (Lio/sentry/ScopeCallback;)V - public fun withScope (Lio/sentry/ScopeCallback;)V -} - public abstract interface class io/sentry/IAppStartExtender { public abstract fun extendAppStart ()V public abstract fun finishExtendedAppStart ()V @@ -933,9 +778,6 @@ public abstract interface class io/sentry/IFeedbackApi { public abstract fun show (Lio/sentry/protocol/SentryId;Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V } -public abstract interface class io/sentry/IHub : io/sentry/IScopes { -} - public abstract interface class io/sentry/ILogger { public abstract fun isEnabled (Lio/sentry/SentryLevel;)Z public abstract fun log (Lio/sentry/SentryLevel;Ljava/lang/String;Ljava/lang/Throwable;)V @@ -1111,7 +953,6 @@ public abstract interface class io/sentry/IScopes { public abstract fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; public abstract fun captureUserFeedback (Lio/sentry/UserFeedback;)V public abstract fun clearBreadcrumbs ()V - public abstract fun clone ()Lio/sentry/IHub; public abstract fun close ()V public abstract fun close (Z)V public fun configureScope (Lio/sentry/ScopeCallback;)V @@ -1142,7 +983,6 @@ public abstract interface class io/sentry/IScopes { public abstract fun logger ()Lio/sentry/logger/ILoggerApi; public abstract fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; public abstract fun metrics ()Lio/sentry/metrics/IMetricsApi; - public abstract fun popScope ()V public abstract fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public abstract fun pushScope ()Lio/sentry/ISentryLifecycleToken; public abstract fun removeAttribute (Ljava/lang/String;)V @@ -1715,83 +1555,6 @@ public final class io/sentry/NoOpFeedbackApi : io/sentry/IFeedbackApi { public fun show (Lio/sentry/protocol/SentryId;Lio/sentry/SentryFeedbackOptions$OptionsConfigurator;)V } -public final class io/sentry/NoOpHub : io/sentry/IHub { - public fun addBreadcrumb (Lio/sentry/Breadcrumb;)V - public fun addBreadcrumb (Lio/sentry/Breadcrumb;Lio/sentry/Hint;)V - public fun addFeatureFlag (Ljava/lang/String;Ljava/lang/Boolean;)V - public fun bindClient (Lio/sentry/ISentryClient;)V - public fun captureCheckIn (Lio/sentry/CheckIn;)Lio/sentry/protocol/SentryId; - public fun captureEnvelope (Lio/sentry/SentryEnvelope;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureEvent (Lio/sentry/SentryEvent;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureException (Ljava/lang/Throwable;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureException (Ljava/lang/Throwable;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureFeedback (Lio/sentry/protocol/Feedback;Lio/sentry/Hint;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;)Lio/sentry/protocol/SentryId; - public fun captureMessage (Ljava/lang/String;Lio/sentry/SentryLevel;Lio/sentry/ScopeCallback;)Lio/sentry/protocol/SentryId; - public fun captureProfileChunk (Lio/sentry/ProfileChunk;)Lio/sentry/protocol/SentryId; - public fun captureReplay (Lio/sentry/SentryReplayEvent;Lio/sentry/Hint;)Lio/sentry/protocol/SentryId; - public fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; - public fun captureUserFeedback (Lio/sentry/UserFeedback;)V - public fun clearBreadcrumbs ()V - public fun clone ()Lio/sentry/IHub; - public synthetic fun clone ()Ljava/lang/Object; - public fun close ()V - public fun close (Z)V - public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V - public fun continueTrace (Ljava/lang/String;Ljava/util/List;)Lio/sentry/TransactionContext; - public fun endSession ()V - public fun feedback ()Lio/sentry/IFeedbackApi; - public fun flush (J)V - public fun forkedCurrentScope (Ljava/lang/String;)Lio/sentry/IScopes; - public fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; - public fun forkedScopes (Ljava/lang/String;)Lio/sentry/IScopes; - public fun getBaggage ()Lio/sentry/BaggageHeader; - public fun getGlobalScope ()Lio/sentry/IScope; - public static fun getInstance ()Lio/sentry/NoOpHub; - public fun getIsolationScope ()Lio/sentry/IScope; - public fun getLastEventId ()Lio/sentry/protocol/SentryId; - public fun getOptions ()Lio/sentry/SentryOptions; - public fun getParentScopes ()Lio/sentry/IScopes; - public fun getRateLimiter ()Lio/sentry/transport/RateLimiter; - public fun getScope ()Lio/sentry/IScope; - public fun getSpan ()Lio/sentry/ISpan; - public fun getTraceparent ()Lio/sentry/SentryTraceHeader; - public fun getTransaction ()Lio/sentry/ITransaction; - public fun isAncestorOf (Lio/sentry/IScopes;)Z - public fun isCrashedLastRun ()Ljava/lang/Boolean; - public fun isEnabled ()Z - public fun isHealthy ()Z - public fun isNoOp ()Z - public fun logger ()Lio/sentry/logger/ILoggerApi; - public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; - public fun metrics ()Lio/sentry/metrics/IMetricsApi; - public fun popScope ()V - public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; - public fun pushScope ()Lio/sentry/ISentryLifecycleToken; - public fun removeAttribute (Ljava/lang/String;)V - public fun removeExtra (Ljava/lang/String;)V - public fun removeTag (Ljava/lang/String;)V - public fun reportFullyDisplayed ()V - public fun setActiveSpan (Lio/sentry/ISpan;)V - public fun setAttribute (Lio/sentry/SentryAttribute;)V - public fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V - public fun setAttributes (Lio/sentry/SentryAttributes;)V - public fun setExtra (Ljava/lang/String;Ljava/lang/String;)V - public fun setFingerprint (Ljava/util/List;)V - public fun setLevel (Lio/sentry/SentryLevel;)V - public fun setSpanContext (Ljava/lang/Throwable;Lio/sentry/ISpan;Ljava/lang/String;)V - public fun setTag (Ljava/lang/String;Ljava/lang/String;)V - public fun setTransaction (Ljava/lang/String;)V - public fun setUser (Lio/sentry/protocol/User;)V - public fun startProfiler ()V - public fun startSession ()V - public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/TransactionOptions;)Lio/sentry/ITransaction; - public fun stopProfiler ()V - public fun withIsolationScope (Lio/sentry/ScopeCallback;)V - public fun withScope (Lio/sentry/ScopeCallback;)V -} - public final class io/sentry/NoOpLogger : io/sentry/ILogger { public static fun getInstance ()Lio/sentry/NoOpLogger; public fun isEnabled (Lio/sentry/SentryLevel;)Z @@ -1929,8 +1692,6 @@ public final class io/sentry/NoOpScopes : io/sentry/IScopes { public fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; public fun captureUserFeedback (Lio/sentry/UserFeedback;)V public fun clearBreadcrumbs ()V - public fun clone ()Lio/sentry/IHub; - public synthetic fun clone ()Ljava/lang/Object; public fun close ()V public fun close (Z)V public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V @@ -1961,7 +1722,6 @@ public final class io/sentry/NoOpScopes : io/sentry/IScopes { public fun logger ()Lio/sentry/logger/ILoggerApi; public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; public fun metrics ()Lio/sentry/metrics/IMetricsApi; - public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; public fun removeAttribute (Ljava/lang/String;)V @@ -2680,8 +2440,6 @@ public final class io/sentry/Scopes : io/sentry/IScopes { public fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; public fun captureUserFeedback (Lio/sentry/UserFeedback;)V public fun clearBreadcrumbs ()V - public fun clone ()Lio/sentry/IHub; - public synthetic fun clone ()Ljava/lang/Object; public fun close ()V public fun close (Z)V public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V @@ -2713,7 +2471,6 @@ public final class io/sentry/Scopes : io/sentry/IScopes { public fun logger ()Lio/sentry/logger/ILoggerApi; public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; public fun metrics ()Lio/sentry/metrics/IMetricsApi; - public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; public fun removeAttribute (Ljava/lang/String;)V @@ -2760,8 +2517,6 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes { public fun captureTransaction (Lio/sentry/protocol/SentryTransaction;Lio/sentry/TraceContext;Lio/sentry/Hint;Lio/sentry/ProfilingTraceData;)Lio/sentry/protocol/SentryId; public fun captureUserFeedback (Lio/sentry/UserFeedback;)V public fun clearBreadcrumbs ()V - public fun clone ()Lio/sentry/IHub; - public synthetic fun clone ()Ljava/lang/Object; public fun close ()V public fun close (Z)V public fun configureScope (Lio/sentry/ScopeType;Lio/sentry/ScopeCallback;)V @@ -2791,7 +2546,6 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes { public fun logger ()Lio/sentry/logger/ILoggerApi; public fun makeCurrent ()Lio/sentry/ISentryLifecycleToken; public fun metrics ()Lio/sentry/metrics/IMetricsApi; - public fun popScope ()V public fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public fun pushScope ()Lio/sentry/ISentryLifecycleToken; public fun removeAttribute (Ljava/lang/String;)V @@ -2900,7 +2654,6 @@ public final class io/sentry/Sentry { public static fun forkedRootScopes (Ljava/lang/String;)Lio/sentry/IScopes; public static fun forkedScopes (Ljava/lang/String;)Lio/sentry/IScopes; public static fun getBaggage ()Lio/sentry/BaggageHeader; - public static fun getCurrentHub ()Lio/sentry/IHub; public static fun getCurrentScopes ()Lio/sentry/IScopes; public static fun getCurrentScopes (Z)Lio/sentry/IScopes; public static fun getExtendedAppStartSpan ()Lio/sentry/ISpan; @@ -2920,7 +2673,6 @@ public final class io/sentry/Sentry { public static fun isHealthy ()Z public static fun logger ()Lio/sentry/logger/ILoggerApi; public static fun metrics ()Lio/sentry/metrics/IMetricsApi; - public static fun popScope ()V public static fun pushIsolationScope ()Lio/sentry/ISentryLifecycleToken; public static fun pushScope ()Lio/sentry/ISentryLifecycleToken; public static fun removeAttribute (Ljava/lang/String;)V @@ -2931,7 +2683,6 @@ public final class io/sentry/Sentry { public static fun setAttribute (Lio/sentry/SentryAttribute;)V public static fun setAttribute (Ljava/lang/String;Ljava/lang/Object;)V public static fun setAttributes (Lio/sentry/SentryAttributes;)V - public static fun setCurrentHub (Lio/sentry/IHub;)Lio/sentry/ISentryLifecycleToken; public static fun setCurrentScopes (Lio/sentry/IScopes;)Lio/sentry/ISentryLifecycleToken; public static fun setExtra (Ljava/lang/String;Ljava/lang/String;)V public static fun setFingerprint (Ljava/util/List;)V diff --git a/sentry/src/main/java/io/sentry/HubAdapter.java b/sentry/src/main/java/io/sentry/HubAdapter.java deleted file mode 100644 index 5e2d91a9ae8..00000000000 --- a/sentry/src/main/java/io/sentry/HubAdapter.java +++ /dev/null @@ -1,427 +0,0 @@ -package io.sentry; - -import io.sentry.logger.ILoggerApi; -import io.sentry.metrics.IMetricsApi; -import io.sentry.protocol.Feedback; -import io.sentry.protocol.SentryId; -import io.sentry.protocol.SentryTransaction; -import io.sentry.protocol.User; -import io.sentry.transport.RateLimiter; -import java.util.List; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @deprecated use {@link ScopesAdapter} instead - */ -@Deprecated -public final class HubAdapter implements IHub { - - private static final HubAdapter INSTANCE = new HubAdapter(); - - private HubAdapter() {} - - public static HubAdapter getInstance() { - return INSTANCE; - } - - @Override - public boolean isEnabled() { - return Sentry.isEnabled(); - } - - @Override - public @NotNull SentryId captureEvent(@NotNull SentryEvent event, @Nullable Hint hint) { - return Sentry.captureEvent(event, hint); - } - - @Override - public @NotNull SentryId captureEvent( - @NotNull SentryEvent event, @Nullable Hint hint, @NotNull ScopeCallback callback) { - return Sentry.captureEvent(event, hint, callback); - } - - @Override - public @NotNull SentryId captureMessage(@NotNull String message, @NotNull SentryLevel level) { - return Sentry.captureMessage(message, level); - } - - @Override - public @NotNull SentryId captureMessage( - @NotNull String message, @NotNull SentryLevel level, @NotNull ScopeCallback callback) { - return Sentry.captureMessage(message, level, callback); - } - - @Override - public @NotNull SentryId captureFeedback(@NotNull Feedback feedback) { - return Sentry.captureFeedback(feedback); - } - - @Override - public @NotNull SentryId captureFeedback(@NotNull Feedback feedback, @Nullable Hint hint) { - return Sentry.captureFeedback(feedback, hint); - } - - @Override - public @NotNull SentryId captureFeedback( - @NotNull Feedback feedback, @Nullable Hint hint, @Nullable ScopeCallback callback) { - return Sentry.captureFeedback(feedback, hint, callback); - } - - @ApiStatus.Internal - @Override - public @NotNull SentryId captureEnvelope(@NotNull SentryEnvelope envelope, @Nullable Hint hint) { - return Sentry.getCurrentScopes().captureEnvelope(envelope, hint); - } - - @Override - public @NotNull SentryId captureException(@NotNull Throwable throwable, @Nullable Hint hint) { - return Sentry.captureException(throwable, hint); - } - - @Override - public @NotNull SentryId captureException( - @NotNull Throwable throwable, @Nullable Hint hint, @NotNull ScopeCallback callback) { - return Sentry.captureException(throwable, hint, callback); - } - - @Override - public void captureUserFeedback(@NotNull UserFeedback userFeedback) { - Sentry.captureUserFeedback(userFeedback); - } - - @Override - public void startSession() { - Sentry.startSession(); - } - - @Override - public void endSession() { - Sentry.endSession(); - } - - @Override - public void close(final boolean isRestarting) { - Sentry.close(); - } - - @Override - public void close() { - Sentry.close(); - } - - @Override - public void addBreadcrumb(@NotNull Breadcrumb breadcrumb, @Nullable Hint hint) { - Sentry.addBreadcrumb(breadcrumb, hint); - } - - @Override - public void addBreadcrumb(final @NotNull Breadcrumb breadcrumb) { - addBreadcrumb(breadcrumb, new Hint()); - } - - @Override - public void setLevel(@Nullable SentryLevel level) { - Sentry.setLevel(level); - } - - @Override - public void setTransaction(@Nullable String transaction) { - Sentry.setTransaction(transaction); - } - - @Override - public void setUser(@Nullable User user) { - Sentry.setUser(user); - } - - @Override - public void setFingerprint(@NotNull List fingerprint) { - Sentry.setFingerprint(fingerprint); - } - - @Override - public void clearBreadcrumbs() { - Sentry.clearBreadcrumbs(); - } - - @Override - public void setTag(@Nullable String key, @Nullable String value) { - Sentry.setTag(key, value); - } - - @Override - public void removeTag(@Nullable String key) { - Sentry.removeTag(key); - } - - @Override - public void setExtra(@Nullable String key, @Nullable String value) { - Sentry.setExtra(key, value); - } - - @Override - public void removeExtra(@Nullable String key) { - Sentry.removeExtra(key); - } - - @Override - public @NotNull SentryId getLastEventId() { - return Sentry.getLastEventId(); - } - - @Override - public @NotNull ISentryLifecycleToken pushScope() { - return Sentry.pushScope(); - } - - @Override - public @NotNull ISentryLifecycleToken pushIsolationScope() { - return Sentry.pushIsolationScope(); - } - - /** - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * ScopesAdapter#pushScope()} or {@link ScopesAdapter#pushIsolationScope()} instead. - */ - @Override - @Deprecated - public void popScope() { - Sentry.popScope(); - } - - @Override - public void withScope(@NotNull ScopeCallback callback) { - Sentry.withScope(callback); - } - - @Override - public void withIsolationScope(@NotNull ScopeCallback callback) { - Sentry.withIsolationScope(callback); - } - - @Override - public void configureScope(@Nullable ScopeType scopeType, @NotNull ScopeCallback callback) { - Sentry.configureScope(scopeType, callback); - } - - @Override - public void bindClient(@NotNull ISentryClient client) { - Sentry.bindClient(client); - } - - @Override - public boolean isHealthy() { - return Sentry.isHealthy(); - } - - @Override - public void flush(long timeoutMillis) { - Sentry.flush(timeoutMillis); - } - - /** - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - */ - @Deprecated - @Override - public @NotNull IHub clone() { - return Sentry.getCurrentScopes().clone(); - } - - @Override - public @NotNull IScopes forkedScopes(@NotNull String creator) { - return Sentry.forkedScopes(creator); - } - - @Override - public @NotNull IScopes forkedCurrentScope(@NotNull String creator) { - return Sentry.forkedCurrentScope(creator); - } - - @Override - public @NotNull IScopes forkedRootScopes(final @NotNull String creator) { - return Sentry.forkedRootScopes(creator); - } - - @Override - public @NotNull ISentryLifecycleToken makeCurrent() { - return NoOpScopesLifecycleToken.getInstance(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getScope() { - return Sentry.getCurrentScopes().getScope(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getIsolationScope() { - return Sentry.getCurrentScopes().getIsolationScope(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getGlobalScope() { - return Sentry.getGlobalScope(); - } - - @Override - public @Nullable IScopes getParentScopes() { - return Sentry.getCurrentScopes().getParentScopes(); - } - - @Override - public boolean isAncestorOf(final @Nullable IScopes otherScopes) { - return Sentry.getCurrentScopes().isAncestorOf(otherScopes); - } - - @Override - public @NotNull SentryId captureTransaction( - @NotNull SentryTransaction transaction, - @Nullable TraceContext traceContext, - @Nullable Hint hint, - @Nullable ProfilingTraceData profilingTraceData) { - return Sentry.getCurrentScopes() - .captureTransaction(transaction, traceContext, hint, profilingTraceData); - } - - @Override - public @NotNull ITransaction startTransaction( - @NotNull TransactionContext transactionContext, - @NotNull TransactionOptions transactionOptions) { - return Sentry.startTransaction(transactionContext, transactionOptions); - } - - @Override - public void startProfiler() { - Sentry.startProfiler(); - } - - @Override - public void stopProfiler() { - Sentry.stopProfiler(); - } - - @Override - public @NotNull SentryId captureProfileChunk( - final @NotNull ProfileChunk profilingContinuousData) { - return Sentry.getCurrentScopes().captureProfileChunk(profilingContinuousData); - } - - @Override - public void setSpanContext( - final @NotNull Throwable throwable, - final @NotNull ISpan span, - final @NotNull String transactionName) { - Sentry.getCurrentScopes().setSpanContext(throwable, span, transactionName); - } - - @Override - public @Nullable ISpan getSpan() { - return Sentry.getCurrentScopes().getSpan(); - } - - @Override - public void setActiveSpan(final @Nullable ISpan span) { - Sentry.getCurrentScopes().setActiveSpan(span); - } - - @Override - @ApiStatus.Internal - public @Nullable ITransaction getTransaction() { - return Sentry.getCurrentScopes().getTransaction(); - } - - @Override - public @NotNull SentryOptions getOptions() { - return Sentry.getCurrentScopes().getOptions(); - } - - @Override - public @Nullable Boolean isCrashedLastRun() { - return Sentry.isCrashedLastRun(); - } - - @Override - public void reportFullyDisplayed() { - Sentry.reportFullyDisplayed(); - } - - @Override - public @Nullable TransactionContext continueTrace( - final @Nullable String sentryTrace, final @Nullable List baggageHeaders) { - return Sentry.continueTrace(sentryTrace, baggageHeaders); - } - - @Override - public @Nullable SentryTraceHeader getTraceparent() { - return Sentry.getTraceparent(); - } - - @Override - public @Nullable BaggageHeader getBaggage() { - return Sentry.getBaggage(); - } - - @Override - @ApiStatus.Experimental - public @NotNull SentryId captureCheckIn(final @NotNull CheckIn checkIn) { - return Sentry.captureCheckIn(checkIn); - } - - @Override - public @NotNull SentryId captureReplay( - final @NotNull SentryReplayEvent replay, final @Nullable Hint hint) { - return Sentry.getCurrentScopes().captureReplay(replay, hint); - } - - @ApiStatus.Internal - @Override - public @Nullable RateLimiter getRateLimiter() { - return Sentry.getCurrentScopes().getRateLimiter(); - } - - @Override - public @NotNull ILoggerApi logger() { - return Sentry.getCurrentScopes().logger(); - } - - @Override - public @NotNull IMetricsApi metrics() { - return Sentry.getCurrentScopes().metrics(); - } - - @Override - public @NotNull IFeedbackApi feedback() { - return Sentry.getCurrentScopes().feedback(); - } - - @Override - public void setAttribute(final @Nullable String key, final @Nullable Object value) { - Sentry.setAttribute(key, value); - } - - @Override - public void setAttribute(final @Nullable SentryAttribute attribute) { - Sentry.setAttribute(attribute); - } - - @Override - public void setAttributes(final @Nullable SentryAttributes attributes) { - Sentry.setAttributes(attributes); - } - - @Override - public void removeAttribute(final @Nullable String key) { - Sentry.removeAttribute(key); - } - - @Override - public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { - Sentry.addFeatureFlag(flag, result); - } -} diff --git a/sentry/src/main/java/io/sentry/HubScopesWrapper.java b/sentry/src/main/java/io/sentry/HubScopesWrapper.java deleted file mode 100644 index 00395292fd5..00000000000 --- a/sentry/src/main/java/io/sentry/HubScopesWrapper.java +++ /dev/null @@ -1,412 +0,0 @@ -package io.sentry; - -import io.sentry.logger.ILoggerApi; -import io.sentry.metrics.IMetricsApi; -import io.sentry.protocol.Feedback; -import io.sentry.protocol.SentryId; -import io.sentry.protocol.SentryTransaction; -import io.sentry.protocol.User; -import io.sentry.transport.RateLimiter; -import java.util.List; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -@SuppressWarnings("deprecation") -@Deprecated -public final class HubScopesWrapper implements IHub { - - private final @NotNull IScopes scopes; - - public HubScopesWrapper(final @NotNull IScopes scopes) { - this.scopes = scopes; - } - - public @NotNull IScopes getScopes() { - return scopes; - } - - @Override - public boolean isEnabled() { - return scopes.isEnabled(); - } - - @Override - public @NotNull SentryId captureEvent(@NotNull SentryEvent event, @Nullable Hint hint) { - return scopes.captureEvent(event, hint); - } - - @Override - public @NotNull SentryId captureEvent( - @NotNull SentryEvent event, @Nullable Hint hint, @NotNull ScopeCallback callback) { - return scopes.captureEvent(event, hint, callback); - } - - @Override - public @NotNull SentryId captureMessage(@NotNull String message, @NotNull SentryLevel level) { - return scopes.captureMessage(message, level); - } - - @Override - public @NotNull SentryId captureMessage( - @NotNull String message, @NotNull SentryLevel level, @NotNull ScopeCallback callback) { - return scopes.captureMessage(message, level, callback); - } - - @Override - public @NotNull SentryId captureFeedback( - @NotNull Feedback feedback, @Nullable Hint hint, @Nullable ScopeCallback callback) { - return scopes.captureFeedback(feedback, hint, callback); - } - - @Override - public @NotNull SentryId captureEnvelope(@NotNull SentryEnvelope envelope, @Nullable Hint hint) { - return scopes.captureEnvelope(envelope, hint); - } - - @Override - public @NotNull SentryId captureException(@NotNull Throwable throwable, @Nullable Hint hint) { - return scopes.captureException(throwable, hint); - } - - @Override - public @NotNull SentryId captureException( - @NotNull Throwable throwable, @Nullable Hint hint, @NotNull ScopeCallback callback) { - return scopes.captureException(throwable, hint, callback); - } - - @Override - public void captureUserFeedback(@NotNull UserFeedback userFeedback) { - scopes.captureUserFeedback(userFeedback); - } - - @Override - public void startSession() { - scopes.startSession(); - } - - @Override - public void endSession() { - scopes.endSession(); - } - - @Override - public void close() { - scopes.close(); - } - - @Override - public void close(boolean isRestarting) { - scopes.close(isRestarting); - } - - @Override - public void addBreadcrumb(@NotNull Breadcrumb breadcrumb, @Nullable Hint hint) { - scopes.addBreadcrumb(breadcrumb, hint); - } - - @Override - public void addBreadcrumb(@NotNull Breadcrumb breadcrumb) { - scopes.addBreadcrumb(breadcrumb); - } - - @Override - public void setLevel(@Nullable SentryLevel level) { - scopes.setLevel(level); - } - - @Override - public void setTransaction(@Nullable String transaction) { - scopes.setTransaction(transaction); - } - - @Override - public void setUser(@Nullable User user) { - scopes.setUser(user); - } - - @Override - public void setFingerprint(@NotNull List fingerprint) { - scopes.setFingerprint(fingerprint); - } - - @Override - public void clearBreadcrumbs() { - scopes.clearBreadcrumbs(); - } - - @Override - public void setTag(@Nullable String key, @Nullable String value) { - scopes.setTag(key, value); - } - - @Override - public void removeTag(@Nullable String key) { - scopes.removeTag(key); - } - - @Override - public void setExtra(@Nullable String key, @Nullable String value) { - scopes.setExtra(key, value); - } - - @Override - public void removeExtra(@Nullable String key) { - scopes.removeExtra(key); - } - - @Override - public @NotNull SentryId getLastEventId() { - return scopes.getLastEventId(); - } - - @Override - public @NotNull ISentryLifecycleToken pushScope() { - return scopes.pushScope(); - } - - @Override - public @NotNull ISentryLifecycleToken pushIsolationScope() { - return scopes.pushIsolationScope(); - } - - /** - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead. - */ - @Override - @Deprecated - public void popScope() { - scopes.popScope(); - } - - @Override - public void withScope(@NotNull ScopeCallback callback) { - scopes.withScope(callback); - } - - @Override - public void withIsolationScope(@NotNull ScopeCallback callback) { - scopes.withIsolationScope(callback); - } - - @Override - public void configureScope(@Nullable ScopeType scopeType, @NotNull ScopeCallback callback) { - scopes.configureScope(scopeType, callback); - } - - @Override - public void bindClient(@NotNull ISentryClient client) { - scopes.bindClient(client); - } - - @Override - public boolean isHealthy() { - return scopes.isHealthy(); - } - - @Override - public void flush(long timeoutMillis) { - scopes.flush(timeoutMillis); - } - - /** - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - */ - @Override - @Deprecated - public @NotNull IHub clone() { - return scopes.clone(); - } - - @Override - public @NotNull IScopes forkedScopes(@NotNull String creator) { - return scopes.forkedScopes(creator); - } - - @Override - public @NotNull IScopes forkedCurrentScope(@NotNull String creator) { - return scopes.forkedCurrentScope(creator); - } - - @Override - public @NotNull IScopes forkedRootScopes(final @NotNull String creator) { - return Sentry.forkedRootScopes(creator); - } - - @Override - public @NotNull ISentryLifecycleToken makeCurrent() { - return scopes.makeCurrent(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getScope() { - return scopes.getScope(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getIsolationScope() { - return scopes.getIsolationScope(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getGlobalScope() { - return Sentry.getGlobalScope(); - } - - @Override - public @Nullable IScopes getParentScopes() { - return scopes.getParentScopes(); - } - - @Override - public boolean isAncestorOf(final @Nullable IScopes otherScopes) { - return scopes.isAncestorOf(otherScopes); - } - - @ApiStatus.Internal - @Override - public @NotNull SentryId captureTransaction( - @NotNull SentryTransaction transaction, - @Nullable TraceContext traceContext, - @Nullable Hint hint, - @Nullable ProfilingTraceData profilingTraceData) { - return scopes.captureTransaction(transaction, traceContext, hint, profilingTraceData); - } - - @Override - public @NotNull SentryId captureProfileChunk(@NotNull ProfileChunk profileChunk) { - return scopes.captureProfileChunk(profileChunk); - } - - @Override - public @NotNull ITransaction startTransaction( - @NotNull TransactionContext transactionContext, - @NotNull TransactionOptions transactionOptions) { - return scopes.startTransaction(transactionContext, transactionOptions); - } - - @Override - public void startProfiler() { - scopes.startProfiler(); - } - - @Override - public void stopProfiler() { - scopes.stopProfiler(); - } - - @ApiStatus.Internal - @Override - public void setSpanContext( - @NotNull Throwable throwable, @NotNull ISpan span, @NotNull String transactionName) { - scopes.setSpanContext(throwable, span, transactionName); - } - - @Override - public @Nullable ISpan getSpan() { - return scopes.getSpan(); - } - - @Override - public void setActiveSpan(final @Nullable ISpan span) { - scopes.setActiveSpan(span); - } - - @ApiStatus.Internal - @Override - public @Nullable ITransaction getTransaction() { - return scopes.getTransaction(); - } - - @Override - public @NotNull SentryOptions getOptions() { - return scopes.getOptions(); - } - - @Override - public @Nullable Boolean isCrashedLastRun() { - return scopes.isCrashedLastRun(); - } - - @Override - public void reportFullyDisplayed() { - scopes.reportFullyDisplayed(); - } - - @Override - public @Nullable TransactionContext continueTrace( - @Nullable String sentryTrace, @Nullable List baggageHeaders) { - return scopes.continueTrace(sentryTrace, baggageHeaders); - } - - @Override - public @Nullable SentryTraceHeader getTraceparent() { - return scopes.getTraceparent(); - } - - @Override - public @Nullable BaggageHeader getBaggage() { - return scopes.getBaggage(); - } - - @Override - public @NotNull SentryId captureCheckIn(@NotNull CheckIn checkIn) { - return scopes.captureCheckIn(checkIn); - } - - @ApiStatus.Internal - @Override - public @Nullable RateLimiter getRateLimiter() { - return scopes.getRateLimiter(); - } - - @Override - public @NotNull SentryId captureReplay(@NotNull SentryReplayEvent replay, @Nullable Hint hint) { - return scopes.captureReplay(replay, hint); - } - - @Override - public @NotNull ILoggerApi logger() { - return scopes.logger(); - } - - @Override - public @NotNull IMetricsApi metrics() { - return scopes.metrics(); - } - - @Override - public @NotNull IFeedbackApi feedback() { - return scopes.feedback(); - } - - @Override - public void setAttribute(final @Nullable String key, final @Nullable Object value) { - scopes.setAttribute(key, value); - } - - @Override - public void setAttribute(final @Nullable SentryAttribute attribute) { - scopes.setAttribute(attribute); - } - - @Override - public void setAttributes(final @Nullable SentryAttributes attributes) { - scopes.setAttributes(attributes); - } - - @Override - public void removeAttribute(final @Nullable String key) { - scopes.removeAttribute(key); - } - - @Override - public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) { - scopes.addFeatureFlag(flag, result); - } -} diff --git a/sentry/src/main/java/io/sentry/IHub.java b/sentry/src/main/java/io/sentry/IHub.java deleted file mode 100644 index 23a7bed7de2..00000000000 --- a/sentry/src/main/java/io/sentry/IHub.java +++ /dev/null @@ -1,9 +0,0 @@ -package io.sentry; - -/** - * SDK API contract which combines a client and scope management - * - * @deprecated please use {@link IScopes} instead - */ -@Deprecated -public interface IHub extends IScopes {} diff --git a/sentry/src/main/java/io/sentry/IScopes.java b/sentry/src/main/java/io/sentry/IScopes.java index 26ea0dcc3ea..3cf57686f8f 100644 --- a/sentry/src/main/java/io/sentry/IScopes.java +++ b/sentry/src/main/java/io/sentry/IScopes.java @@ -353,15 +353,6 @@ default void addBreadcrumb(@NotNull String message, @NotNull String category) { @NotNull ISentryLifecycleToken pushIsolationScope(); - /** - * Removes the first scope and restores its parent. - * - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead. - */ - @Deprecated - void popScope(); - /** * Runs the callback with a new current scope which gets dropped at the end. * @@ -424,17 +415,6 @@ default void configureScope(@NotNull ScopeCallback callback) { */ void flush(long timeoutMillis); - /** - * Clones the Hub - * - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - * @return the cloned Hub - */ - @NotNull - @Deprecated - IHub clone(); - /** * Creates a fork of both current and isolation scope from current scopes. * diff --git a/sentry/src/main/java/io/sentry/NoOpHub.java b/sentry/src/main/java/io/sentry/NoOpHub.java deleted file mode 100644 index d6ec5774e2b..00000000000 --- a/sentry/src/main/java/io/sentry/NoOpHub.java +++ /dev/null @@ -1,362 +0,0 @@ -package io.sentry; - -import io.sentry.logger.ILoggerApi; -import io.sentry.logger.NoOpLoggerApi; -import io.sentry.metrics.IMetricsApi; -import io.sentry.metrics.NoOpMetricsApi; -import io.sentry.protocol.Feedback; -import io.sentry.protocol.SentryId; -import io.sentry.protocol.SentryTransaction; -import io.sentry.protocol.User; -import io.sentry.transport.RateLimiter; -import java.util.List; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @deprecated use {@link NoOpScopes} instead. - */ -@Deprecated -@ApiStatus.Internal -public final class NoOpHub implements IHub { - - private static final NoOpHub instance = new NoOpHub(); - - private final @NotNull SentryOptions emptyOptions = SentryOptions.empty(); - - private NoOpHub() {} - - @Deprecated - public static NoOpHub getInstance() { - return instance; - } - - @Override - public boolean isEnabled() { - return false; - } - - @Override - public @NotNull SentryId captureEvent(@NotNull SentryEvent event, @Nullable Hint hint) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureEvent( - @NotNull SentryEvent event, @Nullable Hint hint, @NotNull ScopeCallback callback) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureMessage(@NotNull String message, @NotNull SentryLevel level) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureMessage( - @NotNull String message, @NotNull SentryLevel level, @NotNull ScopeCallback callback) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureFeedback( - @NotNull Feedback feedback, @Nullable Hint hint, @Nullable ScopeCallback callback) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureEnvelope(@NotNull SentryEnvelope envelope, @Nullable Hint hint) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureException(@NotNull Throwable throwable, @Nullable Hint hint) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureException( - @NotNull Throwable throwable, @Nullable Hint hint, @NotNull ScopeCallback callback) { - return SentryId.EMPTY_ID; - } - - @Deprecated - @Override - public void captureUserFeedback(@NotNull UserFeedback userFeedback) {} - - @Override - public void startSession() {} - - @Override - public void endSession() {} - - @Override - public void close() {} - - @Override - public void close(final boolean isRestarting) {} - - @Override - public void addBreadcrumb(@NotNull Breadcrumb breadcrumb, @Nullable Hint hint) {} - - @Override - public void addBreadcrumb(final @NotNull Breadcrumb breadcrumb) {} - - @Override - public void setLevel(@Nullable SentryLevel level) {} - - @Override - public void setTransaction(@Nullable String transaction) {} - - @Override - public void setUser(@Nullable User user) {} - - @Override - public void setFingerprint(@NotNull List fingerprint) {} - - @Override - public void clearBreadcrumbs() {} - - @Override - public void setTag(@Nullable String key, @Nullable String value) {} - - @Override - public void removeTag(@Nullable String key) {} - - @Override - public void setExtra(@Nullable String key, @Nullable String value) {} - - @Override - public void removeExtra(@Nullable String key) {} - - @Override - public @NotNull SentryId getLastEventId() { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull ISentryLifecycleToken pushScope() { - return NoOpScopesLifecycleToken.getInstance(); - } - - @Override - public @NotNull ISentryLifecycleToken pushIsolationScope() { - return NoOpScopesLifecycleToken.getInstance(); - } - - /** - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead. - */ - @Override - @Deprecated - public void popScope() {} - - @Override - public void withScope(@NotNull ScopeCallback callback) { - callback.run(NoOpScope.getInstance()); - } - - @Override - public void withIsolationScope(@NotNull ScopeCallback callback) { - callback.run(NoOpScope.getInstance()); - } - - @Override - public void configureScope(@Nullable ScopeType scopeType, @NotNull ScopeCallback callback) {} - - @Override - public void bindClient(@NotNull ISentryClient client) {} - - @Override - public boolean isHealthy() { - return true; - } - - @Override - public void flush(long timeoutMillis) {} - - /** - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - */ - @Deprecated - @Override - public @NotNull IHub clone() { - return instance; - } - - @Override - public @NotNull IScopes forkedScopes(@NotNull String creator) { - return NoOpScopes.getInstance(); - } - - @Override - public @NotNull IScopes forkedCurrentScope(@NotNull String creator) { - return NoOpScopes.getInstance(); - } - - @Override - public @NotNull ISentryLifecycleToken makeCurrent() { - return NoOpScopesLifecycleToken.getInstance(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getScope() { - return NoOpScope.getInstance(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getIsolationScope() { - return NoOpScope.getInstance(); - } - - @Override - @ApiStatus.Internal - public @NotNull IScope getGlobalScope() { - return NoOpScope.getInstance(); - } - - @Override - public @Nullable IScopes getParentScopes() { - return null; - } - - @Override - public boolean isAncestorOf(@Nullable IScopes otherScopes) { - return false; - } - - @Override - public @NotNull IScopes forkedRootScopes(final @NotNull String creator) { - return NoOpScopes.getInstance(); - } - - @Override - public @NotNull SentryId captureTransaction( - final @NotNull SentryTransaction transaction, - final @Nullable TraceContext traceContext, - final @Nullable Hint hint, - final @Nullable ProfilingTraceData profilingTraceData) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureProfileChunk(final @NotNull ProfileChunk profileChunk) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull ITransaction startTransaction( - @NotNull TransactionContext transactionContext, - @NotNull TransactionOptions transactionOptions) { - return NoOpTransaction.getInstance(); - } - - @Override - public void startProfiler() {} - - @Override - public void stopProfiler() {} - - @Override - public void setSpanContext( - final @NotNull Throwable throwable, - final @NotNull ISpan spanContext, - final @NotNull String transactionName) {} - - @Override - public @Nullable ISpan getSpan() { - return null; - } - - @Override - public void setActiveSpan(final @Nullable ISpan span) {} - - @Override - public @Nullable ITransaction getTransaction() { - return null; - } - - @Override - public @NotNull SentryOptions getOptions() { - return emptyOptions; - } - - @Override - public @Nullable Boolean isCrashedLastRun() { - return null; - } - - @Override - public void reportFullyDisplayed() {} - - @Override - public @Nullable TransactionContext continueTrace( - final @Nullable String sentryTrace, final @Nullable List baggageHeaders) { - return null; - } - - @Override - public @Nullable SentryTraceHeader getTraceparent() { - return null; - } - - @Override - public @Nullable BaggageHeader getBaggage() { - return null; - } - - @Override - public @NotNull SentryId captureCheckIn(final @NotNull CheckIn checkIn) { - return SentryId.EMPTY_ID; - } - - @Override - public @NotNull SentryId captureReplay(@NotNull SentryReplayEvent replay, @Nullable Hint hint) { - return SentryId.EMPTY_ID; - } - - @Override - public @Nullable RateLimiter getRateLimiter() { - return null; - } - - @Override - public boolean isNoOp() { - return true; - } - - @Override - public @NotNull ILoggerApi logger() { - return NoOpLoggerApi.getInstance(); - } - - @Override - public @NotNull IMetricsApi metrics() { - return NoOpMetricsApi.getInstance(); - } - - @Override - public @NotNull IFeedbackApi feedback() { - return NoOpFeedbackApi.getInstance(); - } - - @Override - public void setAttribute(final @Nullable String key, final @Nullable Object value) {} - - @Override - public void setAttribute(final @Nullable SentryAttribute attribute) {} - - @Override - public void setAttributes(final @Nullable SentryAttributes attributes) {} - - @Override - public void removeAttribute(final @Nullable String key) {} - - @Override - public void addFeatureFlag(final @Nullable String flag, final @Nullable Boolean result) {} -} diff --git a/sentry/src/main/java/io/sentry/NoOpScopes.java b/sentry/src/main/java/io/sentry/NoOpScopes.java index b9c650c42a8..814f2c63748 100644 --- a/sentry/src/main/java/io/sentry/NoOpScopes.java +++ b/sentry/src/main/java/io/sentry/NoOpScopes.java @@ -142,14 +142,6 @@ public void removeExtra(@Nullable String key) {} return NoOpScopesLifecycleToken.getInstance(); } - /** - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead. - */ - @Override - @Deprecated - public void popScope() {} - @Override public void withScope(@NotNull ScopeCallback callback) { callback.run(NoOpScope.getInstance()); @@ -174,16 +166,6 @@ public boolean isHealthy() { @Override public void flush(long timeoutMillis) {} - /** - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - */ - @Deprecated - @Override - public @NotNull IHub clone() { - return NoOpHub.getInstance(); - } - @Override public @NotNull IScopes forkedScopes(@NotNull String creator) { return NoOpScopes.getInstance(); diff --git a/sentry/src/main/java/io/sentry/Scopes.java b/sentry/src/main/java/io/sentry/Scopes.java index d3926d56993..1d6aee3ba5b 100644 --- a/sentry/src/main/java/io/sentry/Scopes.java +++ b/sentry/src/main/java/io/sentry/Scopes.java @@ -687,25 +687,6 @@ public ISentryLifecycleToken pushIsolationScope() { return Sentry.setCurrentScopes(this); } - /** - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead. - */ - @Override - @Deprecated - public void popScope() { - if (!isEnabled()) { - getOptions() - .getLogger() - .log(SentryLevel.WARNING, "Instance is disabled and this 'popScope' call is a no-op."); - } else { - final @Nullable Scopes parent = parentScopes; - if (parent != null) { - parent.makeCurrent(); - } - } - } - @Override public void withScope(final @NotNull ScopeCallback callback) { if (!isEnabled()) { @@ -799,20 +780,6 @@ public void flush(long timeoutMillis) { } } - /** - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - */ - @Override - @Deprecated - @SuppressWarnings("deprecation") - public @NotNull IHub clone() { - if (!isEnabled()) { - getOptions().getLogger().log(SentryLevel.WARNING, "Disabled Scopes cloned."); - } - return new HubScopesWrapper(forkedScopes("scopes clone")); - } - @ApiStatus.Internal @Override public @NotNull SentryId captureTransaction( diff --git a/sentry/src/main/java/io/sentry/ScopesAdapter.java b/sentry/src/main/java/io/sentry/ScopesAdapter.java index b697a950501..f42f0956221 100644 --- a/sentry/src/main/java/io/sentry/ScopesAdapter.java +++ b/sentry/src/main/java/io/sentry/ScopesAdapter.java @@ -178,16 +178,6 @@ public void removeExtra(@Nullable String key) { return Sentry.pushIsolationScope(); } - /** - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * IScopes#pushScope()} or {@link IScopes#pushIsolationScope()} instead. - */ - @Override - @Deprecated - public void popScope() { - Sentry.popScope(); - } - @Override public void withScope(@NotNull ScopeCallback callback) { Sentry.withScope(callback); @@ -218,17 +208,6 @@ public void flush(long timeoutMillis) { Sentry.flush(timeoutMillis); } - /** - * @deprecated please use {@link IScopes#forkedScopes(String)} or {@link - * IScopes#forkedCurrentScope(String)} instead. - */ - @Deprecated - @Override - @SuppressWarnings("deprecation") - public @NotNull IHub clone() { - return Sentry.getCurrentScopes().clone(); - } - @Override public @NotNull IScopes forkedScopes(@NotNull String creator) { return Sentry.forkedScopes(creator); diff --git a/sentry/src/main/java/io/sentry/Sentry.java b/sentry/src/main/java/io/sentry/Sentry.java index 03288ae00ad..ddd512f7ab3 100644 --- a/sentry/src/main/java/io/sentry/Sentry.java +++ b/sentry/src/main/java/io/sentry/Sentry.java @@ -85,21 +85,7 @@ private Sentry() {} private static final AutoClosableReentrantLock lock = new AutoClosableReentrantLock(); - /** - * Returns the current (threads) hub, if none, clones the rootScopes and returns it. - * - * @deprecated please use {@link Sentry#getCurrentScopes()} instead - * @return the hub - */ - @ApiStatus.Internal // exposed for the coroutines integration in SentryContext - @SuppressWarnings("deprecation") - @Deprecated - public static @NotNull IHub getCurrentHub() { - return new HubScopesWrapper(getCurrentScopes()); - } - @ApiStatus.Internal - @SuppressWarnings("deprecation") public static @NotNull IScopes getCurrentScopes() { return getCurrentScopes(true); } @@ -112,7 +98,6 @@ private Sentry() {} * @return current scopes, a root scopes fork or NoopScopes */ @ApiStatus.Internal - @SuppressWarnings("deprecation") public static @NotNull IScopes getCurrentScopes(final boolean ensureForked) { // read the volatile rootScopes once, so a concurrent Sentry.init cannot make the check below // disagree with what we return @@ -163,16 +148,6 @@ private Sentry() {} return getCurrentScopes().forkedCurrentScope(creator); } - /** - * @deprecated please use {@link Sentry#setCurrentScopes} instead. - */ - @ApiStatus.Internal // exposed for the coroutines integration in SentryContext - @Deprecated - @SuppressWarnings({"deprecation", "InlineMeSuggester"}) - public static @NotNull ISentryLifecycleToken setCurrentHub(final @NotNull IHub hub) { - return setCurrentScopes(hub); - } - @ApiStatus.Internal // exposed for the coroutines integration in SentryContext public static @NotNull ISentryLifecycleToken setCurrentScopes(final @NotNull IScopes scopes) { return getScopesStorage().set(scopes); @@ -1098,20 +1073,6 @@ public static void removeExtra(final @Nullable String key) { return NoOpScopesLifecycleToken.getInstance(); } - /** - * Removes the first scope and restores its parent. - * - * @deprecated please call {@link ISentryLifecycleToken#close()} on the token returned by {@link - * Sentry#pushScope()} or {@link Sentry#pushIsolationScope()} instead. - */ - @Deprecated - public static void popScope() { - // popScope is no-op in global hub mode - if (!globalHubMode) { - getCurrentScopes().popScope(); - } - } - /** * Runs the callback with a new current scope which gets dropped at the end. * diff --git a/sentry/src/main/java/io/sentry/util/ScopesUtil.java b/sentry/src/main/java/io/sentry/util/ScopesUtil.java index bfb9b88c8de..2d1034cee01 100644 --- a/sentry/src/main/java/io/sentry/util/ScopesUtil.java +++ b/sentry/src/main/java/io/sentry/util/ScopesUtil.java @@ -29,7 +29,7 @@ public static void printScopesChain(final @Nullable IScopes scopes) { System.out.println("=========================================="); } - @SuppressWarnings({"ObjectToString", "deprecation"}) + @SuppressWarnings("ObjectToString") private static void printScopesChainInternal(final @Nullable IScopes someScopes) { if (someScopes != null) { if (someScopes instanceof Scopes) { @@ -44,12 +44,8 @@ private static void printScopesChainInternal(final @Nullable IScopes someScopes) scopes.getCreator()); System.out.println(info); printScopesChainInternal(someScopes.getParentScopes()); - } else if (someScopes instanceof ScopesAdapter - || someScopes instanceof io.sentry.HubAdapter) { + } else if (someScopes instanceof ScopesAdapter) { printScopesChainInternal(Sentry.getCurrentScopes()); - } else if (someScopes instanceof io.sentry.HubScopesWrapper) { - io.sentry.HubScopesWrapper wrapper = (io.sentry.HubScopesWrapper) someScopes; - printScopesChainInternal(wrapper.getScopes()); } else { System.out.println("Hit unhandled Scopes class" + someScopes.getClass()); } diff --git a/sentry/src/test/java/io/sentry/HubAdapterTest.kt b/sentry/src/test/java/io/sentry/HubAdapterTest.kt deleted file mode 100644 index 0dbb6a43c11..00000000000 --- a/sentry/src/test/java/io/sentry/HubAdapterTest.kt +++ /dev/null @@ -1,339 +0,0 @@ -package io.sentry - -import io.sentry.protocol.Feedback -import io.sentry.protocol.SentryTransaction -import io.sentry.protocol.User -import io.sentry.test.createSentryClientMock -import io.sentry.test.initForTest -import kotlin.test.AfterTest -import kotlin.test.BeforeTest -import kotlin.test.Test -import org.mockito.kotlin.any -import org.mockito.kotlin.anyOrNull -import org.mockito.kotlin.eq -import org.mockito.kotlin.mock -import org.mockito.kotlin.reset -import org.mockito.kotlin.verify -import org.mockito.kotlin.whenever - -class HubAdapterTest { - val scopes: IScopes = mock() - - @BeforeTest - fun `set up`() { - initForTest { it.dsn = "https://key@localhost/proj" } - Sentry.setCurrentScopes(scopes) - } - - @AfterTest - fun shutdown() { - Sentry.close() - } - - @Test - fun `isEnabled calls Hub`() { - HubAdapter.getInstance().isEnabled - verify(scopes).isEnabled - } - - @Test - fun `captureEvent calls Hub`() { - val event = mock() - val hint = mock() - val scopeCallback = mock() - HubAdapter.getInstance().captureEvent(event, hint) - verify(scopes).captureEvent(eq(event), eq(hint)) - - HubAdapter.getInstance().captureEvent(event, hint, scopeCallback) - verify(scopes).captureEvent(eq(event), eq(hint), eq(scopeCallback)) - } - - @Test - fun `captureMessage calls Hub`() { - val scopeCallback = mock() - val sentryLevel = mock() - HubAdapter.getInstance().captureMessage("message", sentryLevel) - verify(scopes).captureMessage(eq("message"), eq(sentryLevel)) - - HubAdapter.getInstance().captureMessage("message", sentryLevel, scopeCallback) - verify(scopes).captureMessage(eq("message"), eq(sentryLevel), eq(scopeCallback)) - } - - @Test - fun `captureFeedback calls Hub`() { - val hint = Hint() - val scopeCallback = mock() - val feedback = Feedback("message") - whenever(scopes.feedback()).thenReturn(FeedbackApi(scopes)) - HubAdapter.getInstance().captureFeedback(feedback) - verify(scopes).captureFeedback(eq(feedback)) - - HubAdapter.getInstance().captureFeedback(feedback, hint) - verify(scopes).captureFeedback(eq(feedback), eq(hint)) - - HubAdapter.getInstance().captureFeedback(feedback, hint, scopeCallback) - verify(scopes).captureFeedback(eq(feedback), eq(hint), eq(scopeCallback)) - } - - @Test - fun `captureEnvelope calls Hub`() { - val envelope = mock() - val hint = mock() - HubAdapter.getInstance().captureEnvelope(envelope, hint) - verify(scopes).captureEnvelope(eq(envelope), eq(hint)) - } - - @Test - fun `captureException calls Hub`() { - val throwable = mock() - val hint = mock() - val scopeCallback = mock() - HubAdapter.getInstance().captureException(throwable, hint) - verify(scopes).captureException(eq(throwable), eq(hint)) - - HubAdapter.getInstance().captureException(throwable, hint, scopeCallback) - verify(scopes).captureException(eq(throwable), eq(hint), eq(scopeCallback)) - } - - @Test - fun `captureUserFeedback calls Hub`() { - val userFeedback = mock() - HubAdapter.getInstance().captureUserFeedback(userFeedback) - verify(scopes).captureUserFeedback(eq(userFeedback)) - } - - @Test - fun `captureCheckIn calls Hub`() { - val checkIn = mock() - HubAdapter.getInstance().captureCheckIn(checkIn) - verify(scopes).captureCheckIn(eq(checkIn)) - } - - @Test - fun `startSession calls Hub`() { - HubAdapter.getInstance().startSession() - verify(scopes).startSession() - } - - @Test - fun `endSession calls Hub`() { - HubAdapter.getInstance().endSession() - verify(scopes).endSession() - } - - @Test - fun `close calls Hub`() { - HubAdapter.getInstance().close() - verify(scopes).close(false) - } - - @Test - fun `close with isRestarting true calls Hub with isRestarting false`() { - HubAdapter.getInstance().close(true) - verify(scopes).close(false) - } - - @Test - fun `close with isRestarting false calls Hub with isRestarting false`() { - HubAdapter.getInstance().close(false) - verify(scopes).close(false) - } - - @Test - fun `addBreadcrumb calls Hub`() { - val breadcrumb = mock() - val hint = mock() - HubAdapter.getInstance().addBreadcrumb(breadcrumb, hint) - verify(scopes).addBreadcrumb(eq(breadcrumb), eq(hint)) - } - - @Test - fun `setLevel calls Hub`() { - val sentryLevel = mock() - HubAdapter.getInstance().setLevel(sentryLevel) - verify(scopes).setLevel(eq(sentryLevel)) - } - - @Test - fun `setTransaction calls Hub`() { - HubAdapter.getInstance().setTransaction("transaction") - verify(scopes).setTransaction(eq("transaction")) - } - - @Test - fun `setUser calls Hub`() { - val user = mock() - HubAdapter.getInstance().setUser(user) - verify(scopes).setUser(eq(user)) - } - - @Test - fun `setFingerprint calls Hub`() { - val fingerprint = ArrayList() - HubAdapter.getInstance().setFingerprint(fingerprint) - verify(scopes).setFingerprint(eq(fingerprint)) - } - - @Test - fun `clearBreadcrumbs calls Hub`() { - HubAdapter.getInstance().clearBreadcrumbs() - verify(scopes).clearBreadcrumbs() - } - - @Test - fun `setTag calls Hub`() { - HubAdapter.getInstance().setTag("key", "value") - verify(scopes).setTag(eq("key"), eq("value")) - } - - @Test - fun `removeTag calls Hub`() { - HubAdapter.getInstance().removeTag("key") - verify(scopes).removeTag(eq("key")) - } - - @Test - fun `setExtra calls Hub`() { - HubAdapter.getInstance().setExtra("key", "value") - verify(scopes).setExtra(eq("key"), eq("value")) - } - - @Test - fun `removeExtra calls Hub`() { - HubAdapter.getInstance().removeExtra("key") - verify(scopes).removeExtra(eq("key")) - } - - @Test - fun `getLastEventId calls Hub`() { - HubAdapter.getInstance().lastEventId - verify(scopes).lastEventId - } - - @Test - fun `pushScope calls Hub`() { - HubAdapter.getInstance().pushScope() - verify(scopes).pushScope() - } - - @Test - fun `popScope calls Hub`() { - HubAdapter.getInstance().popScope() - verify(scopes).popScope() - } - - @Test - fun `withScope calls Hub`() { - val scopeCallback = mock() - HubAdapter.getInstance().withScope(scopeCallback) - verify(scopes).withScope(eq(scopeCallback)) - } - - @Test - fun `configureScope calls Hub`() { - val scopeCallback = mock() - HubAdapter.getInstance().configureScope(scopeCallback) - verify(scopes).configureScope(anyOrNull(), eq(scopeCallback)) - } - - @Test - fun `bindClient calls Hub`() { - val client = createSentryClientMock() - HubAdapter.getInstance().bindClient(client) - verify(scopes).bindClient(eq(client)) - } - - @Test - fun `flush calls Hub`() { - HubAdapter.getInstance().flush(1) - verify(scopes).flush(eq(1)) - } - - @Test - fun `clone calls Hub`() { - HubAdapter.getInstance().clone() - verify(scopes).clone() - } - - @Test - fun `captureTransaction calls Hub`() { - val transaction = mock() - val traceContext = mock() - val hint = mock() - val profilingTraceData = mock() - HubAdapter.getInstance().captureTransaction(transaction, traceContext, hint, profilingTraceData) - verify(scopes) - .captureTransaction(eq(transaction), eq(traceContext), eq(hint), eq(profilingTraceData)) - } - - @Test - fun `captureProfileChunk calls Hub`() { - val profileChunk = mock() - HubAdapter.getInstance().captureProfileChunk(profileChunk) - verify(scopes).captureProfileChunk(eq(profileChunk)) - } - - @Test - fun `startTransaction calls Hub`() { - val transactionContext = mock() - val samplingContext = mock() - val transactionOptions = mock() - HubAdapter.getInstance().startTransaction(transactionContext) - verify(scopes).startTransaction(eq(transactionContext), any()) - - reset(scopes) - - HubAdapter.getInstance().startTransaction(transactionContext, transactionOptions) - verify(scopes).startTransaction(eq(transactionContext), eq(transactionOptions)) - } - - @Test - fun `setSpanContext calls Hub`() { - val throwable = mock() - val span = mock() - HubAdapter.getInstance().setSpanContext(throwable, span, "transactionName") - verify(scopes).setSpanContext(eq(throwable), eq(span), eq("transactionName")) - } - - @Test - fun `getSpan calls Hub`() { - HubAdapter.getInstance().span - verify(scopes).span - } - - @Test - fun `getTransaction calls Hub`() { - HubAdapter.getInstance().transaction - verify(scopes).transaction - } - - @Test - fun `getOptions calls Hub`() { - HubAdapter.getInstance().options - verify(scopes).options - } - - @Test - fun `isCrashedLastRun calls Hub`() { - HubAdapter.getInstance().isCrashedLastRun - verify(scopes).isCrashedLastRun - } - - @Test - fun `reportFullyDisplayed calls Hub`() { - HubAdapter.getInstance().reportFullyDisplayed() - verify(scopes).reportFullyDisplayed() - } - - @Test - fun `startProfiler calls Hub`() { - HubAdapter.getInstance().startProfiler() - verify(scopes).startProfiler() - } - - @Test - fun `stopProfiler calls Hub`() { - HubAdapter.getInstance().stopProfiler() - verify(scopes).stopProfiler() - } -} diff --git a/sentry/src/test/java/io/sentry/NoOpHubTest.kt b/sentry/src/test/java/io/sentry/NoOpHubTest.kt deleted file mode 100644 index 0fa28772619..00000000000 --- a/sentry/src/test/java/io/sentry/NoOpHubTest.kt +++ /dev/null @@ -1,117 +0,0 @@ -package io.sentry - -import io.sentry.protocol.SentryId -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNull -import kotlin.test.assertSame -import org.mockito.kotlin.mock -import org.mockito.kotlin.verify - -class NoOpHubTest { - private var sut: NoOpHub = NoOpHub.getInstance() - - @Test - fun `getLastEventId returns empty SentryId`() = assertEquals(SentryId.EMPTY_ID, sut.lastEventId) - - @Test fun `addBreadcrumb doesn't throw on null breadcrumb`() = sut.addBreadcrumb("breadcrumb") - - @Test fun `hub is always disabled`() = assertFalse(sut.isEnabled) - - @Test - fun `captureEvent returns empty SentryId`() = - assertEquals(SentryId.EMPTY_ID, sut.captureEvent(SentryEvent())) - - @Test - fun `captureTransaction returns empty SentryId`() = - assertEquals(SentryId.EMPTY_ID, sut.captureTransaction(mock(), mock())) - - @Test - fun `captureProfileChunk returns empty SentryId`() = - assertEquals(SentryId.EMPTY_ID, sut.captureProfileChunk(mock())) - - @Test - fun `captureException returns empty SentryId`() = - assertEquals(SentryId.EMPTY_ID, sut.captureException(RuntimeException())) - - @Test - fun `captureMessage returns empty SentryId`() = - assertEquals(SentryId.EMPTY_ID, sut.captureMessage("message")) - - @Test - fun `captureFeedback returns empty SentryId`() = - assertEquals(SentryId.EMPTY_ID, sut.captureFeedback(mock())) - - @Test - fun `close does not affect captureEvent`() { - sut.close() - assertEquals(SentryId.EMPTY_ID, sut.captureEvent(SentryEvent())) - } - - @Test - fun `close with isRestarting true does not affect captureEvent`() { - sut.close(true) - assertEquals(SentryId.EMPTY_ID, sut.captureEvent(SentryEvent())) - } - - @Test - fun `close with isRestarting false does not affect captureEvent`() { - sut.close(false) - assertEquals(SentryId.EMPTY_ID, sut.captureEvent(SentryEvent())) - } - - @Test - fun `close does not affect captureException`() { - sut.close() - assertEquals(SentryId.EMPTY_ID, sut.captureException(RuntimeException())) - } - - @Test - fun `close does not affect captureMessage`() { - sut.close() - assertEquals(SentryId.EMPTY_ID, sut.captureMessage("message")) - } - - @Test - fun `pushScope is no op`() { - sut.pushScope() - } - - @Test fun `popScope is no op`() = sut.popScope() - - @Test fun `flush doesn't throw on null param`() = sut.flush(30000) - - @Test fun `clone returns the same instance`() = assertSame(NoOpHub.getInstance(), sut.clone()) - - @Test - fun `getSpan returns null`() { - assertNull(sut.span) - } - - @Test fun `setSpanContext doesnt throw`() = sut.setSpanContext(RuntimeException(), mock(), "") - - @Test fun `reportFullyDrawn doesnt throw`() = sut.reportFullyDisplayed() - - @Test - fun `getBaggage returns null`() { - assertNull(sut.baggage) - } - - @Test - fun `captureCheckIn returns empty id`() { - assertEquals(SentryId.EMPTY_ID, sut.captureCheckIn(mock())) - } - - @Test - fun `withScopeCallback is executed on NoOpScope`() { - val scopeCallback = mock() - - sut.withScope(scopeCallback) - verify(scopeCallback).run(NoOpScope.getInstance()) - } - - @Test fun `startProfiler doesnt throw`() = sut.startProfiler() - - @Test fun `stopProfiler doesnt throw`() = sut.stopProfiler() -} diff --git a/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt b/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt index 1de22cfd3c3..6b797d7a4a5 100644 --- a/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesAdapterTest.kt @@ -216,12 +216,6 @@ class ScopesAdapterTest { verify(scopes).pushScope() } - @Test - fun `popScope calls Scopes`() { - ScopesAdapter.getInstance().popScope() - verify(scopes).popScope() - } - @Test fun `withScope calls Scopes`() { val scopeCallback = mock() @@ -249,12 +243,6 @@ class ScopesAdapterTest { verify(scopes).flush(eq(1)) } - @Test - fun `clone calls Scopes`() { - ScopesAdapter.getInstance().clone() - verify(scopes).clone() - } - @Test fun `captureTransaction calls Scopes`() { val transaction = mock()