mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-386847 [java]: add default modifier when making interface method non-static
GitOrigin-RevId: fde665d19cdb6fef9cf81e81c93ac8ddcf05789f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
873ef84318
commit
fc7c77754e
@@ -238,6 +238,14 @@ public class ModifierFix extends PsiBasedModCommandAction<PsiModifierListOwner>
|
||||
removeFinalModifierFromMethods(aClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (owner instanceof PsiMethod method && PsiModifier.STATIC.equals(myModifier)) {
|
||||
PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass != null && containingClass.isInterface()) {
|
||||
modifierList.setModifierProperty(PsiModifier.DEFAULT, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
changeModifierList(modifierList);
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Make 'y())' not static" "false"
|
||||
abstract interface Interface {
|
||||
int f();
|
||||
|
||||
static void y() {
|
||||
<caret>f(); // <- Error
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Make 'y()' not static" "true"
|
||||
abstract interface Interface {
|
||||
int f();
|
||||
|
||||
default void y() {
|
||||
f(); // <- Error
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// "Make 'y()' not static" "true"
|
||||
abstract interface Interface {
|
||||
int f();
|
||||
|
||||
static void y() {
|
||||
<caret>f(); // <- Error
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user