@@ -72,12 +72,12 @@ private Scopes(
7272 return creator ;
7373 }
7474
75- // TODO add to IScopes interface
75+ @ Override
7676 public @ NotNull IScope getScope () {
7777 return scope ;
7878 }
7979
80- // TODO add to IScopes interface
80+ @ Override
8181 public @ NotNull IScope getIsolationScope () {
8282 return isolationScope ;
8383 }
@@ -105,25 +105,16 @@ public boolean isAncestorOf(final @Nullable Scopes otherScopes) {
105105 return false ;
106106 }
107107
108- // TODO add to IScopes interface
109- public @ NotNull Scopes forkedScopes (final @ NotNull String creator ) {
108+ @ Override
109+ public @ NotNull IScopes forkedScopes (final @ NotNull String creator ) {
110110 return new Scopes (scope .clone (), isolationScope .clone (), this , options , creator );
111111 }
112112
113- // TODO add to IScopes interface
114- public @ NotNull Scopes forkedCurrentScope (final @ NotNull String creator ) {
115- IScope clone = scope .clone ();
116- // TODO should use isolation scope
117- // return new Scopes(clone, isolationScope, this, options, creator);
118- return new Scopes (clone , clone , this , options , creator );
113+ @ Override
114+ public @ NotNull IScopes forkedCurrentScope (final @ NotNull String creator ) {
115+ return new Scopes (scope .clone (), isolationScope , this , options , creator );
119116 }
120117
121- // // TODO in Sentry.init?
122- // public static Scopes forkedRoots(final @NotNull SentryOptions options, final @NotNull String
123- // creator) {
124- // return new Scopes(ROOT_SCOPE.clone(), ROOT_ISOLATION_SCOPE.clone(), options, creator);
125- // }
126-
127118 // TODO always read from root scope?
128119 @ Override
129120 public boolean isEnabled () {
@@ -602,12 +593,28 @@ public ISentryLifecycleToken pushScope() {
602593 .log (SentryLevel .WARNING , "Instance is disabled and this 'pushScope' call is a no-op." );
603594 return NoOpScopesStorage .NoOpScopesLifecycleToken .getInstance ();
604595 } else {
605- Scopes scopes = this .forkedCurrentScope ("pushScope" );
596+ final @ NotNull IScopes scopes = this .forkedCurrentScope ("pushScope" );
606597 return scopes .makeCurrent ();
607598 }
608599 }
609600
610- public ISentryLifecycleToken makeCurrent () {
601+ @ Override
602+ public ISentryLifecycleToken pushIsolationScope () {
603+ if (!isEnabled ()) {
604+ options
605+ .getLogger ()
606+ .log (
607+ SentryLevel .WARNING ,
608+ "Instance is disabled and this 'pushIsolationScope' call is a no-op." );
609+ return NoOpScopesStorage .NoOpScopesLifecycleToken .getInstance ();
610+ } else {
611+ final @ NotNull IScopes scopes = this .forkedScopes ("pushIsolationScope" );
612+ return scopes .makeCurrent ();
613+ }
614+ }
615+
616+ @ Override
617+ public @ NotNull ISentryLifecycleToken makeCurrent () {
611618 return Sentry .setCurrentScopes (this );
612619 }
613620
@@ -638,7 +645,7 @@ public void withScope(final @NotNull ScopeCallback callback) {
638645 }
639646
640647 } else {
641- Scopes forkedScopes = forkedCurrentScope ("withScope" );
648+ final @ NotNull IScopes forkedScopes = forkedCurrentScope ("withScope" );
642649 // TODO should forkedScopes be made current inside callback?
643650 // TODO forkedScopes.makeCurrent()?
644651 try {
0 commit comments