mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
forbid native in interfaces (IDEA-140491)
This commit is contained in:
@@ -941,6 +941,10 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
isAllowed &= modifierOwnerParent instanceof PsiClass && !((PsiClass)modifierOwnerParent).isInterface();
|
||||
}
|
||||
|
||||
if (containingClass != null && containingClass.isInterface()) {
|
||||
isAllowed &= !PsiModifier.NATIVE.equals(modifier);
|
||||
}
|
||||
|
||||
if (containingClass != null && containingClass.isAnnotationType()) {
|
||||
isAllowed &= !PsiModifier.STATIC.equals(modifier);
|
||||
isAllowed &= !PsiModifier.DEFAULT.equals(modifier);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
interface A {
|
||||
default <error descr="Modifier 'native' not allowed here">native</error> void m(){}
|
||||
static <error descr="Modifier 'native' not allowed here">native</error> void m1(){}
|
||||
<error descr="Modifier 'native' not allowed here">native</error> void m2();
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
public void testStaticMethodCalls() { doTest(false, false); }
|
||||
public void testStaticMethodCallsAndOverloadResolution() { doTest(false, false); }
|
||||
public void testDefaultMethodOverrideEquivalentObject() { doTest(false, false); }
|
||||
public void testModifierNativeInInterface() { doTest(false, false); }
|
||||
public void testStaticMethods() { doTest(false, false); }
|
||||
public void testFinalStaticDefaultMethods() { doTest(false, false); }
|
||||
public void testIDEA122720() { doTest(false, false); }
|
||||
|
||||
Reference in New Issue
Block a user