void (@NotNull PsiPackageAccessibilityStatement statement, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { Set<String> targets = new HashSet<>(); for (PsiJavaModuleReferenceElement refElement : statement.getModuleReferences()) { String refText = refElement.getReferenceText(); PsiJavaModuleReference ref = refElement.getReference(); assert ref != null : statement; if (!targets.add(refText)) { boolean exports = statement.getRole() == Role.EXPORTS; String message = JavaErrorBundle.message(exports ? "module.duplicate.exports.target" : "module.duplicate.opens.target", refText); HighlightInfo.Builder info = createDuplicateReference(refElement, message); errorSink.accept(info); } else if (ref.multiResolve(true).length == 0) { String message = JavaErrorBundle.message("module.not.found", refElement.getReferenceText()); HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.WARNING).range(refElement).descriptionAndTooltip(message); errorSink.accept(info); } } }