diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java b/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java index 1296526078f3..6ec833027918 100644 --- a/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java @@ -25,6 +25,7 @@ import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.registry.Registry; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; @@ -139,10 +140,21 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext else if (entry instanceof LibraryOrderEntry) { final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)entry; final Library library = libraryOrderEntry.getLibrary(); - if (library == null || library.getFiles(OrderRootType.CLASSES).length < library.getUrls(OrderRootType.CLASSES).length) { + if (library == null) { System.err.println(InspectionsBundle.message("offline.inspections.library.was.not.resolved", libraryOrderEntry.getPresentableName(), module.getName())); } + else { + Set detectedUrls = + Arrays.stream(library.getFiles(OrderRootType.CLASSES)).map(file -> file.getUrl()).collect(Collectors.toSet()); + HashSet declaredUrls = new HashSet<>(Arrays.asList(library.getUrls(OrderRootType.CLASSES))); + declaredUrls.removeAll(detectedUrls); + if (!declaredUrls.isEmpty()) { + System.err.println(InspectionsBundle.message("offline.inspections.library.urls.were.not.resolved", + StringUtil.join(declaredUrls, ", "), + libraryOrderEntry.getPresentableName(), module.getName())); + } + } } } } diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties index 222c808880d9..d63c4dca11ab 100644 --- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties +++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties @@ -743,6 +743,7 @@ nullable.stuff.problems.overridden.method.parameters.are.not.annotated=Overridde annotate.overridden.methods.parameters=Annotate overridden method parameters as ''@{0}'' annotate.overridden.methods.parameters.family.name=Annotate overridden method parameters offline.inspections.library.was.not.resolved=Please configure library ''{0}'' which is used in module ''{1}'' +offline.inspections.library.urls.were.not.resolved=Roots {0} of the library ''{1}'' from module ''{2}'' were not resolved report.suspicious.but.possibly.correct.method.calls=&Report suspicious but possibly correct method calls unused.library.display.name=Unused library unused.library.problem.descriptor=Unused library ''{0}''