mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-121952 (Java 1.8: "Interface may be annotated with @FunctionalInterface" inspection reports already annotated interfaces)
This commit is contained in:
+2
-1
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.siyeh.ig.classlayout;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.intention.AddAnnotationPsiFix;
|
||||
import com.intellij.psi.LambdaHighlightingUtil;
|
||||
import com.intellij.psi.LambdaUtil;
|
||||
@@ -71,7 +72,7 @@ public class InterfaceMayBeAnnotatedFunctionalInspection extends BaseInspection
|
||||
return;
|
||||
}
|
||||
super.visitClass(aClass);
|
||||
if (!aClass.isInterface()) {
|
||||
if (!aClass.isInterface() || AnnotationUtil.isAnnotated(aClass, "java.lang.FunctionalInterface", false)) {
|
||||
return;
|
||||
}
|
||||
if (LambdaHighlightingUtil.checkInterfaceFunctional(aClass) != null) {
|
||||
|
||||
+6
@@ -44,6 +44,12 @@ public class InterfaceMayBeAnnotatedFunctionalInspectionTest extends LightInspec
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testAlreadyAnnotated() {
|
||||
doTest("@FunctionalInterface interface Asd {" +
|
||||
" boolean doSmth();" +
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testAnnotationType() {
|
||||
doTest("@interface A {}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user