Ejemplo n.º 1
0
 @Nullable
 public static String checkFunctionalInterface(
     @NotNull PsiAnnotation annotation, @NotNull LanguageLevel languageLevel) {
   if (languageLevel.isAtLeast(LanguageLevel.JDK_1_8)
       && Comparing.strEqual(annotation.getQualifiedName(), JAVA_LANG_FUNCTIONAL_INTERFACE)) {
     final PsiAnnotationOwner owner = annotation.getOwner();
     if (owner instanceof PsiModifierList) {
       final PsiElement parent = ((PsiModifierList) owner).getParent();
       if (parent instanceof PsiClass) {
         return LambdaHighlightingUtil.checkInterfaceFunctional(
             (PsiClass) parent, ((PsiClass) parent).getName() + " is not a functional interface");
       }
     }
   }
   return null;
 }