mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
clear ClsParameter.name cache on roots change (IDEA-136727)
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.roots.FileIndexFacade;
|
||||
import com.intellij.openapi.util.AtomicNotNullLazyValue;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.psi.*;
|
||||
@@ -30,10 +31,13 @@ import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
import com.intellij.psi.util.CachedValuesManager;
|
||||
import com.intellij.ui.RowIcon;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -63,34 +67,37 @@ public class ClsParameterImpl extends ClsRepositoryPsiElement<PsiParameterStub>
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
String name = myName;
|
||||
|
||||
if (name == null) {
|
||||
PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
|
||||
if (!parameterStub.isAutoGeneratedName()) {
|
||||
name = parameterStub.getName();
|
||||
return CachedValuesManager.getCachedValue(this, new CachedValueProvider<String>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public Result<String> compute() {
|
||||
return Result.create(calcName(),
|
||||
getContainingFile(),
|
||||
getContainingFile().getNavigationElement(),
|
||||
FileIndexFacade.getInstance(getProject()).getRootModificationTracker());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (name == null) {
|
||||
if (DumbService.getInstance(getProject()).isDumb()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope();
|
||||
PsiMethod sourceMethod = method.getSourceMirrorMethod();
|
||||
if (sourceMethod != null) {
|
||||
assert sourceMethod != method : method;
|
||||
name = sourceMethod.getParameterList().getParameters()[getIndex()].getName();
|
||||
}
|
||||
else {
|
||||
name = getMirrorName();
|
||||
}
|
||||
}
|
||||
|
||||
myName = name;
|
||||
@Nullable
|
||||
private String calcName() {
|
||||
PsiParameterStubImpl parameterStub = (PsiParameterStubImpl)getStub();
|
||||
if (!parameterStub.isAutoGeneratedName()) {
|
||||
return parameterStub.getName();
|
||||
}
|
||||
|
||||
if (DumbService.getInstance(getProject()).isDumb()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return name;
|
||||
ClsMethodImpl method = (ClsMethodImpl)getDeclarationScope();
|
||||
PsiMethod sourceMethod = method.getSourceMirrorMethod();
|
||||
if (sourceMethod != null) {
|
||||
assert sourceMethod != method : method;
|
||||
return sourceMethod.getParameterList().getParameters()[getIndex()].getName();
|
||||
}
|
||||
|
||||
return getMirrorName();
|
||||
}
|
||||
|
||||
public boolean isAutoGeneratedName() {
|
||||
|
||||
Reference in New Issue
Block a user