drop allowSlowOperations usages

GitOrigin-RevId: 5118241ba0c9a06018104f24f10d4a47f1d630dd
This commit is contained in:
Gregory.Shrago
2024-08-20 18:45:44 +04:00
committed by intellij-monorepo-bot
parent bc3b7f8235
commit 3af17c93f0
6 changed files with 8 additions and 30 deletions

View File

@@ -25,7 +25,6 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiModifier;
import com.intellij.ui.LayeredIcon;
import com.intellij.util.SlowOperations;
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.breakpoints.XBreakpoint;
@@ -97,9 +96,9 @@ public final class CollectionBreakpoint extends BreakpointWithHighlighter<JavaCo
if (psiClass != null) {
getProperties().myClassName = psiClass.getQualifiedName();
}
myIsPrivate = SlowOperations.allowSlowOperations(() -> field.hasModifierProperty(PsiModifier.PRIVATE));
myIsFinal = SlowOperations.allowSlowOperations(() -> field.hasModifierProperty(PsiModifier.FINAL));
myIsStatic = SlowOperations.allowSlowOperations(() -> field.hasModifierProperty(PsiModifier.STATIC));
myIsPrivate = field.hasModifierProperty(PsiModifier.PRIVATE);
myIsFinal = field.hasModifierProperty(PsiModifier.FINAL);
myIsStatic = field.hasModifierProperty(PsiModifier.STATIC);
}
myClsPrepared = false;
myAllMethodsEntryRequestIsEnabled = false;

View File

@@ -5,7 +5,6 @@ import com.intellij.codeInsight.hints.presentation.InlayPresentation
import com.intellij.codeInsight.hints.presentation.PresentationFactory
import com.intellij.codeInsight.hints.presentation.SequencePresentation
import com.intellij.psi.*
import com.intellij.util.SlowOperations
/**
* Creates InlayPresentation for given PsiType.
@@ -72,10 +71,8 @@ class JavaTypeHintsPresentationFactory(private val myFactory: PresentationFactor
}
private fun parametersHint(classType: PsiClassType, level: Int, context: Context): InlayPresentation {
return SlowOperations.allowSlowOperations<InlayPresentation, Throwable> {
context.lengthAvailable -= 2
join(classType.parameters.map { hint(it, level + 1, context) }, ", ", context)
}
context.lengthAvailable -= 2
return join(classType.parameters.map { hint(it, level + 1, context) }, ", ", context)
}
private fun classHint(aClass: PsiClass, level: Int, context: Context): InlayPresentation? {

View File

@@ -61,10 +61,6 @@ public final class SlowOperations {
* If you get an exception from this method, then you need to move the computation to a background thread (BGT)
* and to avoid blocking the UI thread (EDT).
* <p/>
* It's okay if the API changes in the process. For example, instead of wrapping an implementation of some extension
* with deprecated {@link #allowSlowOperations} methods, it is better to admit that the EP semantic as a whole requires index access,
* and then move the iteration over all extensions to the background on the platform-side.
* <p/>
* To temporarily mute the assertion in cases when it's difficult to rework the code timely,
* the computation can be wrapped in a named section {@link #startSection}.
* The assertion inside named sections is turned on/off separately via Registry keys {@code ide.slow.operations.assertion.<sectionName>}
@@ -194,9 +190,7 @@ public final class SlowOperations {
@ApiStatus.ScheduledForRemoval
@Deprecated
public static <T, E extends Throwable> T allowSlowOperations(@NotNull ThrowableComputable<T, E> computable) throws E {
try (AccessToken ignore = startSection(GENERIC)) {
return computable.compute();
}
return computable.compute();
}
/**
@@ -251,7 +245,6 @@ public final class SlowOperations {
* semantics, like {@link #FORCE_ASSERT}, and {@link #RESET}.
* <p/>
* <b>This method is not for muting the assertion in places. It is intended for the common platform code.
* USE DEPRECATED {@link #allowSlowOperations} METHODS IF YOUR INTENT IS TO POSTPONE FIXING THE ASSERTION FOR REAL.</b>
*
* @param sectionName reuse {@link #GENERIC} and other existing section names as much as possible.
* <p/>

View File

@@ -283,7 +283,7 @@ final class UpdateFoldRegionsOperation implements Runnable {
region.isExpanded());
return true;
}
PsiElement element = SlowOperations.allowSlowOperations(() -> info.getPsiElement(region));
PsiElement element = info.getPsiElement(region);
if (element != null) {
PsiFile containingFile = element.getContainingFile();
boolean isInjected = InjectedLanguageManager.getInstance(myProject).isInjectedFragment(containingFile);

View File

@@ -8,11 +8,9 @@ import com.intellij.openapi.editor.Editor
import com.intellij.openapi.module.Module
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.ThrowableComputable
import com.intellij.psi.JavaDirectoryService
import com.intellij.psi.PsiElement
import com.intellij.psi.createSmartPointer
import com.intellij.util.SlowOperations
import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
@@ -74,9 +72,7 @@ fun <D : KtNamedDeclaration> generateExpectOrActualInFile(
val targetFilePointer = targetFile.createSmartPointer()
DumbService.getInstance(project).runWhenSmart(fun() {
val generated = try {
SlowOperations.allowSlowOperations(ThrowableComputable {
factory.generateIt(project, TypeAccessibilityChecker.create(project, module), element)
})
factory.generateIt(project, TypeAccessibilityChecker.create(project, module), element)
} catch (e: KotlinTypeInaccessibleException) {
if (editor != null) {
showErrorHint(

View File

@@ -10,7 +10,6 @@ import com.intellij.completion.ml.util.RelevanceUtil
import com.intellij.completion.ml.util.idString
import com.intellij.stats.completion.LookupEntryInfo
import com.intellij.stats.completion.LookupState
import com.intellij.util.SlowOperations
class LookupStateManager(private val shouldLogElementFeatures: Boolean) {
private val elementToId = mutableMapOf<String, Int>()
@@ -19,12 +18,6 @@ class LookupStateManager(private val shouldLogElementFeatures: Boolean) {
private var currentSessionFactors: Map<String, String> = emptyMap()
fun update(lookup: LookupImpl, factorsUpdated: Boolean): LookupState {
return SlowOperations.allowSlowOperations<LookupState, Throwable> {
doUpdate(lookup, factorsUpdated)
}
}
private fun doUpdate(lookup: LookupImpl, factorsUpdated: Boolean): LookupState {
val ids = mutableListOf<Int>()
val newIds = mutableSetOf<Int>()