Skip to content

Commit dc4d9d6

Browse files
adinauerclaude
andcommitted
ref(core): Remove deprecated Hub APIs
Remove the Hub compatibility layer and migration aliases now that IScopes and Scopes are the supported APIs. Refs GH-3069 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 768ca8e commit dc4d9d6

26 files changed

Lines changed: 11 additions & 2101 deletions

File tree

‎.cursor/rules/api.mdc‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,13 @@ When adding a new method that users can call (e.g. a new scope operation), these
6363
7. `NoOpScope` — no-op stub for `IScope`
6464
8. `NoOpScopes` — no-op stub for `IScopes`
6565
9. `ScopesAdapter` — delegates to `Sentry` static API
66-
10. `HubAdapter` — deprecated bridge from old `IHub` API
67-
11. `HubScopesWrapper` — wraps `IScopes` as `IHub`
6866

6967
### Serialization (if the data is sent to Sentry)
70-
12. Add serialization/deserialization in the relevant data class or create a new one implementing `JsonSerializable` and `JsonDeserializer`
68+
10. Add serialization/deserialization in the relevant data class or create a new one implementing `JsonSerializable` and `JsonDeserializer`
7169

7270
### Tests
73-
13. Write tests for all implementations, especially `Scope`, `Scopes`, `SentryTest`, and any new data classes
74-
14. No-op classes typically don't need separate tests unless they have non-trivial logic
71+
11. Write tests for all implementations, especially `Scope`, `Scopes`, `SentryTest`, and any new data classes
72+
12. No-op classes typically don't need separate tests unless they have non-trivial logic
7573

7674
## Protocol / Data Model Classes
7775

‎.cursor/rules/scopes.mdc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Data itself is stored on `Scope` instances.
1414
## `Hub`
1515

1616
Up until major version 7 of the Java SDK the `IHub` interface was a central part of the SDK.
17-
In major version 8 we replaced the `IHub` interface with `IScopes`. `IHub` has been deprecated.
18-
While there is some bridging code in place to allow for easier migration, we are planning to remove it in an upcoming major.
17+
In major version 8 we replaced the `IHub` interface with `IScopes` and deprecated the Hub compatibility APIs.
18+
Those compatibility APIs were removed in major version 9.
1919

2020
## Scope Types
2121

‎sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class SentryAndroidTest {
353353
fun `init starts session replay if app is in foreground`() {
354354
initSentryWithForegroundImportance(true) { _ ->
355355
Shadows.shadowOf(Looper.getMainLooper()).idle()
356-
assertTrue(Sentry.getCurrentHub().options.replayController.isRecording())
356+
assertTrue(Sentry.getCurrentScopes().options.replayController.isRecording())
357357
}
358358
}
359359

@@ -362,7 +362,7 @@ class SentryAndroidTest {
362362
fun `init does not start session replay if the app is in background`() {
363363
initSentryWithForegroundImportance(false) { _ ->
364364
Shadows.shadowOf(Looper.getMainLooper()).idle()
365-
assertFalse(Sentry.getCurrentHub().options.replayController.isRecording())
365+
assertFalse(Sentry.getCurrentScopes().options.replayController.isRecording())
366366
}
367367
}
368368

‎sentry-android-integration-tests/sentry-uitest-android-critical/src/main/java/io/sentry/uitest/android/critical/MainActivity.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class MainActivity : ComponentActivity() {
3636

3737
super.onCreate(savedInstanceState)
3838
val outboxPath =
39-
Sentry.getCurrentHub().options.outboxPath ?: throw RuntimeException("Outbox path is not set.")
39+
Sentry.getCurrentScopes().options.outboxPath
40+
?: throw RuntimeException("Outbox path is not set.")
4041

4142
requestPermissionLauncher =
4243
registerForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted: Boolean ->

‎sentry-graphql-core/api/sentry-graphql-core.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public final class io/sentry/graphql/ExceptionReporter {
1111
public final class io/sentry/graphql/ExceptionReporter$ExceptionDetails {
1212
public fun <init> (Lio/sentry/IScopes;Lgraphql/execution/instrumentation/parameters/InstrumentationExecutionParameters;Z)V
1313
public fun <init> (Lio/sentry/IScopes;Lgraphql/schema/DataFetchingEnvironment;Z)V
14-
public fun getHub ()Lio/sentry/IScopes;
1514
public fun getQuery ()Ljava/lang/String;
1615
public fun getScopes ()Lio/sentry/IScopes;
1716
public fun getVariables ()Ljava/util/Map;

‎sentry-graphql-core/src/main/java/io/sentry/graphql/ExceptionReporter.java‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,6 @@ public boolean isSubscription() {
163163
return isSubscription;
164164
}
165165

166-
/**
167-
* @deprecated please use {@link ExceptionDetails#getScopes()} instead.
168-
*/
169-
@Deprecated
170-
public @NotNull IScopes getHub() {
171-
return scopes;
172-
}
173-
174166
public @NotNull IScopes getScopes() {
175167
return scopes;
176168
}

‎sentry-spring-7/api/sentry-spring-7.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ public final class io/sentry/spring7/tracing/TransactionNameWithSource {
376376
}
377377

378378
public abstract class io/sentry/spring7/webflux/AbstractSentryWebFilter : org/springframework/web/server/WebFilter {
379-
public static final field SENTRY_HUB_KEY Ljava/lang/String;
380379
public static final field SENTRY_SCOPES_KEY Ljava/lang/String;
381380
public fun <init> (Lio/sentry/IScopes;)V
382381
protected fun doFinally (Lorg/springframework/web/server/ServerWebExchange;Lio/sentry/IScopes;Lio/sentry/ITransaction;)V

‎sentry-spring-7/src/main/java/io/sentry/spring7/webflux/AbstractSentryWebFilter.java‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public abstract class AbstractSentryWebFilter implements WebFilter {
3737
private final @NotNull SentryRequestResolver sentryRequestResolver;
3838
public static final String SENTRY_SCOPES_KEY = "sentry-scopes";
3939

40-
/**
41-
* @deprecated please use {@link AbstractSentryWebFilter#SENTRY_SCOPES_KEY} instead.
42-
*/
43-
@Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY;
44-
4540
private static final String TRANSACTION_OP = "http.server";
4641

4742
public AbstractSentryWebFilter(final @NotNull IScopes scopes) {

‎sentry-spring-jakarta/api/sentry-spring-jakarta.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@ public final class io/sentry/spring/jakarta/tracing/TransactionNameWithSource {
376376
}
377377

378378
public abstract class io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter : org/springframework/web/server/WebFilter {
379-
public static final field SENTRY_HUB_KEY Ljava/lang/String;
380379
public static final field SENTRY_SCOPES_KEY Ljava/lang/String;
381380
public fun <init> (Lio/sentry/IScopes;)V
382381
protected fun doFinally (Lorg/springframework/web/server/ServerWebExchange;Lio/sentry/IScopes;Lio/sentry/ITransaction;)V

‎sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/webflux/AbstractSentryWebFilter.java‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ public abstract class AbstractSentryWebFilter implements WebFilter {
3737
private final @NotNull SentryRequestResolver sentryRequestResolver;
3838
public static final String SENTRY_SCOPES_KEY = "sentry-scopes";
3939

40-
/**
41-
* @deprecated please use {@link AbstractSentryWebFilter#SENTRY_SCOPES_KEY} instead.
42-
*/
43-
@Deprecated public static final String SENTRY_HUB_KEY = SENTRY_SCOPES_KEY;
44-
4540
private static final String TRANSACTION_OP = "http.server";
4641

4742
public AbstractSentryWebFilter(final @NotNull IScopes scopes) {

0 commit comments

Comments
 (0)