mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
IDEA-121215 (Java 1.8: "Interface may be annotated with @FunctionalInterface" inspection should not report @interfaces)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -185,7 +185,7 @@ public class LambdaUtil {
|
||||
if (psiClass instanceof PsiAnonymousClass) {
|
||||
psiClass = PsiUtil.resolveClassInType(((PsiAnonymousClass)psiClass).getBaseClassType());
|
||||
}
|
||||
if (psiClass != null && psiClass.isInterface()) {
|
||||
if (psiClass != null && psiClass.isInterface() && !psiClass.isAnnotationType()) {
|
||||
final List<MethodSignature> methods = new ArrayList<MethodSignature>();
|
||||
final Collection<HierarchicalMethodSignature> visibleSignatures = psiClass.getVisibleSignatures();
|
||||
for (HierarchicalMethodSignature signature : visibleSignatures) {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<error descr="Test is not a functional interface">@FunctionalInterface</error>
|
||||
@interface Test {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -77,6 +77,7 @@ public class LambdaHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIntersectionTypeInCast() { doTest(); }
|
||||
public void testAmbiguitySpecificReturn() { doTest(true); }
|
||||
public void testFunctionalInterfaceAnnotation() { doTest(); }
|
||||
public void testFunctionalInterfaceAnnotation2() { doTest(); }
|
||||
public void testAmbiguityReturnValueResolution() { doTest(); }
|
||||
public void testAmbiguityReturnValueResolution1() { doTest(); }
|
||||
public void testAmbiguityReturnValueResolution2() { doTest(true); }
|
||||
|
||||
@@ -44,6 +44,10 @@ public class InterfaceMayBeAnnotatedFunctionalInspectionTest extends LightInspec
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testAnnotationType() {
|
||||
doTest("@interface A {}");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new InterfaceMayBeAnnotatedFunctionalInspection();
|
||||
|
||||
Reference in New Issue
Block a user