mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
forbid 'static'/'default' in annotation types
This commit is contained in:
@@ -889,6 +889,11 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
PsiModifier.STRICTFP.equals(modifier) || PsiModifier.SYNCHRONIZED.equals(modifier)) {
|
||||
isAllowed &= modifierOwnerParent instanceof PsiClass && !((PsiClass)modifierOwnerParent).isInterface();
|
||||
}
|
||||
|
||||
if (containingClass != null && containingClass.isAnnotationType()) {
|
||||
isAllowed &= !PsiModifier.STATIC.equals(modifier);
|
||||
isAllowed &= !PsiModifier.DEFAULT.equals(modifier);
|
||||
}
|
||||
}
|
||||
else if (modifierOwner instanceof PsiField) {
|
||||
if (PsiModifier.PRIVATE.equals(modifier) || PsiModifier.PROTECTED.equals(modifier) || PsiModifier.TRANSIENT.equals(modifier) ||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@interface Example {
|
||||
|
||||
public <error descr="Modifier 'static' not allowed here">static</error> String myMethod() {
|
||||
return "";
|
||||
}
|
||||
public <error descr="Modifier 'default' not allowed here">default</error> String myMethod1() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,9 @@ public class Interface8MethodsHighlightingTest extends LightCodeInsightFixtureTe
|
||||
public void testDefaultSupersInStaticContext() {
|
||||
doTest(false, false);
|
||||
}
|
||||
public void testAnnotationTypeExtensionsNotSupported() {
|
||||
doTest(false, false);
|
||||
}
|
||||
|
||||
public void testSuperProtectedCalls() throws Exception {
|
||||
myFixture.addClass("package p; public class Foo {" +
|
||||
|
||||
Reference in New Issue
Block a user