mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
change signature conflicts: read access + process all overriding methods
EA-118949 - assert: SharedImplUtil.findFileElement
This commit is contained in:
+31
-21
@@ -25,12 +25,16 @@ import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.ReadActionProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.impl.source.resolve.JavaResolveUtil;
|
||||
import com.intellij.psi.scope.processor.VariablesProcessor;
|
||||
import com.intellij.psi.scope.util.PsiScopesUtil;
|
||||
@@ -1149,30 +1153,36 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
|
||||
public static void searchForHierarchyConflicts(PsiMethod method, MultiMap<PsiElement, String> conflicts, final String modifier) {
|
||||
SuperMethodsSearch.search(method, ReadAction.compute(() -> method.getContainingClass()), true, false).forEach(
|
||||
methodSignature -> {
|
||||
final PsiMethod superMethod = methodSignature.getMethod();
|
||||
if (!hasCompatibleVisibility(superMethod, true, modifier)) {
|
||||
conflicts.putValue(superMethod, IntentionPowerPackBundle.message(
|
||||
"0.will.have.incompatible.access.privileges.with.super.1",
|
||||
new ReadActionProcessor<MethodSignatureBackedByPsiMethod>() {
|
||||
@Override
|
||||
public boolean processInReadAction(MethodSignatureBackedByPsiMethod methodSignature) {
|
||||
final PsiMethod superMethod = methodSignature.getMethod();
|
||||
if (!hasCompatibleVisibility(superMethod, true, modifier)) {
|
||||
conflicts.putValue(superMethod, IntentionPowerPackBundle.message(
|
||||
"0.will.have.incompatible.access.privileges.with.super.1",
|
||||
RefactoringUIUtil.getDescription(method, false),
|
||||
RefactoringUIUtil.getDescription(superMethod, true)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
OverridingMethodsSearch.search(method).forEach(new ReadActionProcessor<PsiMethod>() {
|
||||
@Override
|
||||
public boolean processInReadAction(PsiMethod overridingMethod) {
|
||||
if (!isVisibleFromOverridingMethod(method, overridingMethod, modifier)) {
|
||||
conflicts.putValue(overridingMethod, IntentionPowerPackBundle.message(
|
||||
"0.will.no.longer.be.visible.from.overriding.1",
|
||||
RefactoringUIUtil.getDescription(method, false),
|
||||
RefactoringUIUtil.getDescription(superMethod, true)));
|
||||
RefactoringUIUtil.getDescription(overridingMethod, true)));
|
||||
}
|
||||
else if (!hasCompatibleVisibility(overridingMethod, false, modifier)) {
|
||||
conflicts.putValue(overridingMethod, IntentionPowerPackBundle.message(
|
||||
"0.will.have.incompatible.access.privileges.with.overriding.1",
|
||||
RefactoringUIUtil.getDescription(method, false),
|
||||
RefactoringUIUtil.getDescription(overridingMethod, true)));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
OverridingMethodsSearch.search(method).forEach(overridingMethod -> {
|
||||
if (!isVisibleFromOverridingMethod(method, overridingMethod, modifier)) {
|
||||
conflicts.putValue(overridingMethod, IntentionPowerPackBundle.message(
|
||||
"0.will.no.longer.be.visible.from.overriding.1",
|
||||
RefactoringUIUtil.getDescription(method, false),
|
||||
RefactoringUIUtil.getDescription(overridingMethod, true)));
|
||||
}
|
||||
else if (!hasCompatibleVisibility(overridingMethod, false, modifier)) {
|
||||
conflicts.putValue(overridingMethod, IntentionPowerPackBundle.message(
|
||||
"0.will.have.incompatible.access.privileges.with.overriding.1",
|
||||
RefactoringUIUtil.getDescription(method, false),
|
||||
RefactoringUIUtil.getDescription(overridingMethod, true)));
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user