File tree Expand file tree Collapse file tree 6 files changed +16
-12
lines changed
Expand file tree Collapse file tree 6 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -1061,7 +1061,7 @@ public abstract interface class io/sentry/IScopesStorage {
10611061}
10621062
10631063public abstract interface class io/sentry/IScopesStorageFactory {
1064- public abstract fun create ()Lio/sentry/IScopesStorage;
1064+ public abstract fun create (Lio/sentry/util/LoadClass;Lio/sentry/ILogger; )Lio/sentry/IScopesStorage;
10651065}
10661066
10671067public 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 {
2635+ public final class io/sentry/ScopesStorageFactory : io/sentry/IScopesStorageFactory {
26362636 public fun <init> ()V
2637- public static fun create (Lio/sentry/util/LoadClass;Lio/sentry/ILogger;)Lio/sentry/IScopesStorage;
2637+ public fun create (Lio/sentry/util/LoadClass;Lio/sentry/ILogger;)Lio/sentry/IScopesStorage;
26382638}
26392639
26402640public final class io/sentry/ScreenshotStrategyType : java/lang/Enum {
Original file line number Diff line number Diff line change 11package io .sentry ;
22
3+ import io .sentry .util .LoadClass ;
34import org .jetbrains .annotations .ApiStatus ;
45import org .jetbrains .annotations .NotNull ;
56
67/** Factory for creating custom {@link IScopesStorage} implementations. */
78@ ApiStatus .Experimental
89public interface IScopesStorageFactory {
910 @ NotNull
10- IScopesStorage create ();
11+ IScopesStorage create (final @ NotNull LoadClass loadClass , final @ NotNull ILogger logger );
1112}
Original file line number Diff line number Diff line change 88import org .jetbrains .annotations .Nullable ;
99
1010@ ApiStatus .Internal
11- public final class ScopesStorageFactory {
11+ public final class ScopesStorageFactory implements IScopesStorageFactory {
1212
1313 private static final String OTEL_SCOPES_STORAGE =
1414 "io.sentry.opentelemetry.OtelContextScopesStorage" ;
1515
16- public static @ NotNull IScopesStorage create (
16+ @ Override
17+ public @ NotNull IScopesStorage create (
1718 final @ NotNull LoadClass loadClass , final @ NotNull ILogger logger ) {
1819 final @ NotNull IScopesStorage storage = createInternal (loadClass , logger );
1920 storage .init ();
Original file line number Diff line number Diff line change @@ -439,13 +439,15 @@ 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 ();
442444 if (options .getScopesStorageFactory () != null ) {
443- scopesStorage = options .getScopesStorageFactory ().create ();
445+ scopesStorage = options .getScopesStorageFactory ().create (loadClass , logger );
444446 scopesStorage .init ();
445447 } else if (SentryOpenTelemetryMode .OFF == options .getOpenTelemetryMode ()) {
446448 scopesStorage = new DefaultScopesStorage ();
447449 } else {
448- scopesStorage = ScopesStorageFactory . create ( new LoadClass (), NoOpLogger . getInstance () );
450+ scopesStorage = new ScopesStorageFactory (). create ( loadClass , logger );
449451 }
450452 }
451453
Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments