java8: static method with body is allowed in interface (IDEA-100334)

This commit is contained in:
Anna Kozlova
2013-02-04 14:07:09 +04:00
parent e8c454f426
commit 68f7ee96f7
6 changed files with 57 additions and 6 deletions
@@ -50,7 +50,7 @@ class D {
}
interface IllegalMods {
<error descr="Illegal combination of modifiers: 'static' and 'abstract'">static</error> void m1();
<error descr="Static methods in interfaces should have a body">static void m1()</error>;
<error descr="Illegal combination of modifiers: 'static' and 'default'">static</error> void m2() default { }
<error descr="Illegal combination of modifiers: 'static' and 'default'">static</error> <error descr="Illegal combination of modifiers: 'default' and 'static'">default</error> void m3() { }
@@ -0,0 +1,4 @@
interface Foo {
public static void bar1() {}
public <error descr="Illegal combination of modifiers: 'abstract' and 'static'">abstract</error> static void bar2() {}
}
@@ -0,0 +1,31 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.codeInsight.daemon.lambda;
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
import org.jetbrains.annotations.NonNls;
public class Interface8MethodsHighlightingTest extends LightDaemonAnalyzerTestCase {
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/interfaceMethods";
public void testStaticMethod() throws Exception {
doTest();
}
private void doTest() throws Exception {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", false, false);
}
}
@@ -1,5 +1,7 @@
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.pom.java.LanguageLevel;
public class ModifierTest extends LightQuickFixTestCase {
public void test() throws Exception { doAllTests(); }
@@ -7,4 +9,9 @@ public class ModifierTest extends LightQuickFixTestCase {
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/modifier";
}
@Override
protected LanguageLevel getLanguageLevel() {
return LanguageLevel.JDK_1_7;
}
}