diff --git a/platform/util/src/com/intellij/util/concurrency/AtomicFieldUpdater.java b/platform/util/src/com/intellij/util/concurrency/AtomicFieldUpdater.java index eea178befdce..5a08f75b7be4 100644 --- a/platform/util/src/com/intellij/util/concurrency/AtomicFieldUpdater.java +++ b/platform/util/src/com/intellij/util/concurrency/AtomicFieldUpdater.java @@ -35,14 +35,16 @@ import java.lang.reflect.Modifier; * - new methods "forFieldXXX" added that search by field type instead of field name, which is useful in scrambled classes */ public class AtomicFieldUpdater { - private static final Unsafe unsafe = getUnsafe(); - - @NotNull - public static Unsafe getUnsafe() { - Unsafe unsafe = ReflectionUtil.getStaticFieldValue(Unsafe.class, Unsafe.class, "theUnsafe"); + private static final Unsafe unsafe; + static { + unsafe = ReflectionUtil.getStaticFieldValue(Unsafe.class, Unsafe.class, "theUnsafe"); if (unsafe == null) { throw new RuntimeException("Could not find 'theUnsafe' field in the " + Unsafe.class); } + } + + @NotNull + public static Unsafe getUnsafe() { return unsafe; }