From 0776c439d0c4552eb4fbb420b1e078213d25d449 Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Mon, 24 Mar 2025 17:07:19 +0100 Subject: [PATCH] cleanup: make `assertSlowOperationsAreAllowed` readable and debuggable GitOrigin-RevId: 83e801986400ccb2ddef418d5a7193a7c9e9bb0a --- .../src/com/intellij/util/SlowOperations.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platform/core-api/src/com/intellij/util/SlowOperations.java b/platform/core-api/src/com/intellij/util/SlowOperations.java index ceea0849c4d5..e1072f48c4e1 100644 --- a/platform/core-api/src/com/intellij/util/SlowOperations.java +++ b/platform/core-api/src/com/intellij/util/SlowOperations.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.util; import com.intellij.diagnostic.LoadingState; @@ -106,14 +106,19 @@ public final class SlowOperations { * @see com.intellij.openapi.actionSystem.ex.ActionUtil#underModalProgress */ public static void assertSlowOperationsAreAllowed() { - String error = !EDT.isCurrentThreadEdt() || - isAlwaysAllowed() || - isSlowOperationAllowed() ? null : ERROR_EDT; - if (error == null || isAlreadyReported()) return; + if (!EDT.isCurrentThreadEdt()) { + return; + } + if (isAlwaysAllowed() || isSlowOperationAllowed()) { + return; + } + if (isAlreadyReported()) { + return; + } if (isInSection(FORCE_THROW) && !Cancellation.isInNonCancelableSection()) { throw new SlowOperationCanceledException(); } - Holder.LOG.error(error); + Holder.LOG.error(ERROR_EDT); } /**