void (@NotNull PsiElement element, @NotNull AnnotationHolder holder) { final VirtualFile file = PsiUtilCore.getVirtualFile(element); if (file != null && file.getFileType() instanceof SPIFileType) { final String serviceProviderName = file.getName(); final PsiClass psiClass = ClassUtil.findPsiClass(element.getManager(), serviceProviderName, null, true, element.getContainingFile().getResolveScope()); if (element instanceof PsiFile) { if (psiClass == null) { holder.newAnnotation(HighlightSeverity.ERROR, JavaBundle.message("spi.no.provider.error.message", serviceProviderName)).fileLevel().create(); } } else if (element instanceof SPIClassProviderReferenceElement) { final PsiElement resolve = ((SPIClassProviderReferenceElement)element).resolve(); if (resolve == null) { holder.newAnnotation(HighlightSeverity.ERROR, AnalysisBundle.message("cannot.resolve.symbol", element.getText())).create(); } else if (resolve instanceof PsiClass && psiClass != null && !InheritanceUtil.isInheritorOrSelf((PsiClass)resolve, psiClass, true)) { holder.newAnnotation(HighlightSeverity.ERROR, JavaBundle.message("spi.extension.error.message", serviceProviderName)).create(); } } } }