disable make method default for annotation types

This commit is contained in:
Anna Kozlova
2017-06-05 11:27:42 +03:00
parent fc8847672d
commit fdda043526
3 changed files with 9 additions and 2 deletions
@@ -47,7 +47,7 @@ public class MakeMethodDefaultIntention extends BaseElementAtCaretIntentionActio
if (psiMethod != null && PsiUtil.isLanguageLevel8OrHigher(psiMethod)) {
if (psiMethod.getBody() == null && !psiMethod.hasModifierProperty(PsiModifier.DEFAULT)) {
final PsiClass containingClass = psiMethod.getContainingClass();
if (containingClass != null && containingClass.isInterface()) {
if (containingClass != null && containingClass.isInterface() && !containingClass.isAnnotationType()) {
text = "Make '" + psiMethod.getName() + "()' default";
return true;
}
@@ -0,0 +1,3 @@
@interface I {
String fo<caret>o() default "foo";
}
@@ -15,7 +15,6 @@
*/
package com.siyeh.ipp.types;
import com.siyeh.IntentionPowerPackBundle;
import com.siyeh.ipp.IPPTestCase;
public class MakeMethodDefaultTest extends IPPTestCase {
@@ -41,4 +40,9 @@ public class MakeMethodDefaultTest extends IPPTestCase {
public void testAlreadyHasBody() throws Exception {
assertIntentionNotAvailable();
}
public void testAnnotationType() throws Exception {
assertIntentionNotAvailable();
}
}