diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/NotNullCachedComputableWrapper.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/NotNullCachedComputableWrapper.java index 50177afb8851..03db6342d81a 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/NotNullCachedComputableWrapper.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/NotNullCachedComputableWrapper.java @@ -25,6 +25,8 @@ import java.util.concurrent.atomic.AtomicReference; public class NotNullCachedComputableWrapper implements NotNullComputable { + private static final RecursionGuard ourGuard = RecursionManager.createGuard(NotNullCachedComputableWrapper.class.getName()); + private volatile NotNullComputable myComputable; private final AtomicReference myValueRef = new AtomicReference<>(); @@ -42,7 +44,7 @@ public class NotNullCachedComputableWrapper implements NotNullComputable { final NotNullComputable computable = myComputable; if (computable == null) continue; // computable is null only after some thread succeeds CAS - RecursionGuard.StackStamp stamp = RecursionManager.createGuard(computable.getClass().getName()).markStack(); + RecursionGuard.StackStamp stamp = ourGuard.markStack(); value = computable.compute(); if (stamp.mayCacheNow()) { if (myValueRef.compareAndSet(null, value)) { // try to cache value