[java-compiler] IDEA-354499 After building the project, find usages is broken for Record

- workaround, actual problems in jps-javac-extension, because it doesn't support RECORD as type

GitOrigin-RevId: 8cc695f9ba2672cff732496678f16cd3d96b83ed
This commit is contained in:
Mikhail Pyltsin
2024-08-02 19:21:04 +02:00
committed by intellij-monorepo-bot
parent e9fdbf0b00
commit f58f454022

View File

@@ -24,6 +24,7 @@ import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.ModificationTracker;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.io.FileAttributes;
@@ -32,6 +33,7 @@ import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.registry.RegistryManager;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiNamedElement;
@@ -359,7 +361,13 @@ public abstract class CompilerReferenceServiceBase<Reader extends CompilerRefere
private boolean isServiceEnabledFor(PsiElement element) {
if (!isActive() || isInsideLibraryScope()) return false;
PsiFile file = ReadAction.compute(() -> element.getContainingFile());
Pair<PsiFile, Boolean> result = ReadAction.compute(
() -> new Pair<>(element.getContainingFile(),
element instanceof PsiClass psiClass && psiClass.isRecord()));
if (result.second) {
return false; //a workaround until jps-javac-extension will not be fixed
}
PsiFile file = result.getFirst();
return file != null && !InjectedLanguageManager.getInstance(project).isInjectedFragment(file);
}