complete statement should add body to private interface methods (jdk9)

This commit is contained in:
peter
2015-03-23 18:54:03 +01:00
parent dad8c490de
commit 7e8644b3a2
4 changed files with 12 additions and 2 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,3 @@
public interface Foo {
private void foo(<caret>)
}

View File

@@ -0,0 +1,5 @@
public interface Foo {
private void foo() {
<caret>
}
}

View File

@@ -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(); }