accept static methods with body in interfaces (IDEA-124745)

This commit is contained in:
Anna Kozlova
2014-05-05 13:42:32 +04:00
parent e4a77b6a34
commit dc73135a77
3 changed files with 22 additions and 1 deletions

View File

@@ -135,7 +135,7 @@ public class CreateFromUsageUtils {
JVMElementFactory factory = JVMElementFactories.getFactory(aClass.getLanguage(), aClass.getProject());
LOG.assertTrue(!aClass.isInterface() || method.hasModifierProperty(PsiModifier.DEFAULT), "Interface bodies should be already set up");
LOG.assertTrue(!aClass.isInterface() || method.hasModifierProperty(PsiModifier.DEFAULT) || method.hasModifierProperty(PsiModifier.STATIC), "Interface bodies should be already set up");
FileType fileType = FileTypeManager.getInstance().getFileTypeByExtension(template.getExtension());
Properties properties = new Properties();

View File

@@ -0,0 +1,12 @@
// "Create Method 'fooBar'" "true"
interface I {
static void fooBar() {
}
}
class Test {
void test() {
Runnable runnable = I::fooBar;
}
}

View File

@@ -0,0 +1,9 @@
// "Create Method 'fooBar'" "true"
interface I {
}
class Test {
void test() {
Runnable runnable = I::foo<caret>Bar;
}
}