mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
complete statement should add body to private interface methods (jdk9)
This commit is contained in:
@@ -67,8 +67,9 @@ public class MissingMethodBodyFixer implements Fixer {
|
||||
static boolean shouldHaveBody(PsiMethod method) {
|
||||
PsiClass containingClass = method.getContainingClass();
|
||||
if (containingClass == null) return false;
|
||||
if (method.hasModifierProperty(PRIVATE)) return true;
|
||||
if (method.hasModifierProperty(ABSTRACT) || method.hasModifierProperty(NATIVE)) return false;
|
||||
if (containingClass.isInterface() && !method.hasModifierProperty(DEFAULT) && !method.hasModifierProperty(STATIC)) return false;
|
||||
if (method.hasModifierProperty(ABSTRACT)) return false;
|
||||
return !method.hasModifierProperty(NATIVE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
public interface Foo {
|
||||
private void foo(<caret>)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public interface Foo {
|
||||
private void foo() {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
@@ -272,6 +272,7 @@ public class CompleteStatementTest extends EditorActionTestCase {
|
||||
|
||||
public void testDefaultMethodBody() { doTest(); }
|
||||
public void testStaticInterfaceMethodBody() { doTest(); }
|
||||
public void testPrivateInterfaceMethodBody() { doTest(); }
|
||||
|
||||
public void testArrayInitializerRBracket() throws Exception { doTest(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user