mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Revert "[java-highlighting] Illegal combination of modifiers:"
This reverts commit 7264f47c76068c36b4aa4b33f2f796dc1c2c0312. GitOrigin-RevId: 3136e780d1cf5511db49b7c1be09df356d05b449
This commit is contained in:
committed by
intellij-monorepo-bot
parent
144c061631
commit
0f95f7408f
+1
-19
@@ -956,31 +956,13 @@ public final class HighlightUtil {
|
||||
String message = JavaErrorBundle.message("incompatible.modifiers", modifier, incompatible);
|
||||
HighlightInfo highlightInfo =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(keyword).descriptionAndTooltip(message).create();
|
||||
String modifierToRemove = getModifierToRemove(modifierList, modifier, incompatible);
|
||||
IntentionAction fix =
|
||||
modifierToRemove == null ? null : getFixFactory().createModifierListFix(modifierList, modifierToRemove, false, false);
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, fix);
|
||||
QuickFixAction.registerQuickFixAction(highlightInfo, getFixFactory().createModifierListFix(modifierList, modifier, false, false));
|
||||
return highlightInfo;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@PsiModifier.ModifierConstant @Nullable
|
||||
private static String getModifierToRemove(@NotNull PsiModifierList modifierList,
|
||||
@PsiModifier.ModifierConstant @NotNull String modifier,
|
||||
String incompatible) {
|
||||
if (PsiModifier.FINAL.equals(incompatible)) {
|
||||
PsiElement parent = modifierList.getParent();
|
||||
if (parent instanceof PsiMethod) {
|
||||
PsiClass aClass = ((PsiMethod)parent).getContainingClass();
|
||||
if (aClass == null) return null;
|
||||
if (aClass.isInterface()) return PsiModifier.FINAL;
|
||||
}
|
||||
}
|
||||
return modifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the supplied modifier list contains incompatible modifiers (e.g. "public private").
|
||||
*
|
||||
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Make 'x' not final" "true"
|
||||
interface X {
|
||||
default void x() {}
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Make 'x' not default" "true"
|
||||
abstract class X {
|
||||
final void x() {}
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Make 'x' not final" "true"
|
||||
interface X {
|
||||
static void x() {}
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Make 'x' not final" "true"
|
||||
interface X {
|
||||
default<caret> final void x() {}
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Make 'x' not default" "true"
|
||||
abstract class X {
|
||||
default<caret> final void x() {}
|
||||
}
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// "Make 'x' not final" "true"
|
||||
interface X {
|
||||
static<caret> final void x() {}
|
||||
}
|
||||
Reference in New Issue
Block a user