Skip to content

Commit 6368b19

Browse files
committed
Revert "ref(core): Have ScopesStorageFactory implement IScopesStorageFactory"
This reverts commit a0d77eb.
1 parent a0d77eb commit 6368b19

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

sentry/api/sentry.api

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ public abstract interface class io/sentry/IScopesStorage {
10611061
}
10621062

10631063
public abstract interface class io/sentry/IScopesStorageFactory {
1064-
public abstract fun create (Lio/sentry/util/LoadClass;Lio/sentry/ILogger;)Lio/sentry/IScopesStorage;
1064+
public abstract fun create ()Lio/sentry/IScopesStorage;
10651065
}
10661066

10671067
public abstract interface class io/sentry/ISentryClient {
@@ -2632,9 +2632,9 @@ public final class io/sentry/ScopesAdapter : io/sentry/IScopes {
26322632
public fun withScope (Lio/sentry/ScopeCallback;)V
26332633
}
26342634

2635-
public final class io/sentry/ScopesStorageFactory : io/sentry/IScopesStorageFactory {
2635+
public final class io/sentry/ScopesStorageFactory {
26362636
public fun <init> ()V
2637-
public fun create (Lio/sentry/util/LoadClass;Lio/sentry/ILogger;)Lio/sentry/IScopesStorage;
2637+
public static fun create (Lio/sentry/util/LoadClass;Lio/sentry/ILogger;)Lio/sentry/IScopesStorage;
26382638
}
26392639

26402640
public final class io/sentry/ScreenshotStrategyType : java/lang/Enum {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package io.sentry;
22

3-
import io.sentry.util.LoadClass;
43
import org.jetbrains.annotations.ApiStatus;
54
import org.jetbrains.annotations.NotNull;
65

76
/** Factory for creating custom {@link IScopesStorage} implementations. */
87
@ApiStatus.Experimental
98
public interface IScopesStorageFactory {
109
@NotNull
11-
IScopesStorage create(final @NotNull LoadClass loadClass, final @NotNull ILogger logger);
10+
IScopesStorage create();
1211
}

sentry/src/main/java/io/sentry/ScopesStorageFactory.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
import org.jetbrains.annotations.Nullable;
99

1010
@ApiStatus.Internal
11-
public final class ScopesStorageFactory implements IScopesStorageFactory {
11+
public final class ScopesStorageFactory {
1212

1313
private static final String OTEL_SCOPES_STORAGE =
1414
"io.sentry.opentelemetry.OtelContextScopesStorage";
1515

16-
@Override
17-
public @NotNull IScopesStorage create(
16+
public static @NotNull IScopesStorage create(
1817
final @NotNull LoadClass loadClass, final @NotNull ILogger logger) {
1918
final @NotNull IScopesStorage storage = createInternal(loadClass, logger);
2019
storage.init();

sentry/src/main/java/io/sentry/Sentry.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,13 @@ private static void initFatalLogger(final @NotNull SentryOptions options) {
439439

440440
private static void initScopesStorage(SentryOptions options) {
441441
getScopesStorage().close();
442-
final @NotNull LoadClass loadClass = new LoadClass();
443-
final @NotNull ILogger logger = NoOpLogger.getInstance();
444442
if (options.getScopesStorageFactory() != null) {
445-
scopesStorage = options.getScopesStorageFactory().create(loadClass, logger);
443+
scopesStorage = options.getScopesStorageFactory().create();
446444
scopesStorage.init();
447445
} else if (SentryOpenTelemetryMode.OFF == options.getOpenTelemetryMode()) {
448446
scopesStorage = new DefaultScopesStorage();
449447
} else {
450-
scopesStorage = new ScopesStorageFactory().create(loadClass, logger);
448+
scopesStorage = ScopesStorageFactory.create(new LoadClass(), NoOpLogger.getInstance());
451449
}
452450
}
453451

sentry/src/test/java/io/sentry/SentryOptionsTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,15 +974,15 @@ class SentryOptionsTest {
974974
@Test
975975
fun `scopesStorageFactory can be set and retrieved`() {
976976
val options = SentryOptions()
977-
val factory = IScopesStorageFactory { _, _ -> DefaultScopesStorage() }
977+
val factory = IScopesStorageFactory { DefaultScopesStorage() }
978978
options.scopesStorageFactory = factory
979979
assertSame(factory, options.scopesStorageFactory)
980980
}
981981

982982
@Test
983983
fun `scopesStorageFactory can be set to null`() {
984984
val options = SentryOptions()
985-
val factory = IScopesStorageFactory { _, _ -> DefaultScopesStorage() }
985+
val factory = IScopesStorageFactory { DefaultScopesStorage() }
986986
options.scopesStorageFactory = factory
987987
options.scopesStorageFactory = null
988988
assertNull(options.scopesStorageFactory)

sentry/src/test/java/io/sentry/SentryTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ class SentryTest {
17321732

17331733
initForTest {
17341734
it.dsn = dsn
1735-
it.scopesStorageFactory = IScopesStorageFactory { _, _ -> customStorage }
1735+
it.scopesStorageFactory = IScopesStorageFactory { customStorage }
17361736
}
17371737

17381738
verify(customStorage).init()
@@ -1758,7 +1758,7 @@ class SentryTest {
17581758

17591759
initForTest {
17601760
it.dsn = dsn
1761-
it.scopesStorageFactory = IScopesStorageFactory { _, _ ->
1761+
it.scopesStorageFactory = IScopesStorageFactory {
17621762
factoryCalled.set(true)
17631763
backingStorage
17641764
}

0 commit comments

Comments
 (0)