IJP-961 allow slow operations in the common cases for the time being

GitOrigin-RevId: 34c4d3a16e01eb560fc9ae284a8e65cedfb9c54c
This commit is contained in:
Daniil Ovchinnikov
2021-01-22 16:33:52 +00:00
committed by intellij-monorepo-bot
parent 4a3ef63f04
commit 20be9891bc
54 changed files with 266 additions and 180 deletions
@@ -1,10 +1,11 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.structureView.impl.java;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.psi.*;
import com.intellij.psi.impl.PsiImplUtil;
import com.intellij.psi.impl.light.LightElement;
import com.intellij.util.SlowOperations;
import org.jetbrains.annotations.NotNull;
import java.util.*;
@@ -58,6 +59,10 @@ public class JavaClassTreeElement extends JavaClassTreeElementBase<PsiClass> {
}
static LinkedHashSet<PsiElement> getOwnChildren(@NotNull PsiClass aClass) {
return SlowOperations.allowSlowOperations(() -> doGetOwnChildren(aClass));
}
private static @NotNull LinkedHashSet<PsiElement> doGetOwnChildren(@NotNull PsiClass aClass) {
LinkedHashSet<PsiElement> members = new LinkedHashSet<>();
addPhysicalElements(aClass.getFields(), members, aClass);
addPhysicalElements(aClass.getMethods(), members, aClass);