boolean (@NotNull ArtifactPackagingElement element, @NotNull PackagingElementPath path) { if (artifact.getName().equals(element.getArtifactName())) { FList<Pair<Artifact, CompositePackagingElement<?>>> currentPath = pathFromRoot; final List<CompositePackagingElement<?>> parents = path.getParents(); for (int i = 0, parentsSize = parents.size(); i < parentsSize - 1; i++) { CompositePackagingElement<?> parent = parents.get(i); if (!processor.process(parent, currentPath, anArtifact)) { return false; } currentPath = currentPath.prepend(new Pair<>(anArtifact, parent)); if (currentPath.size() > maxLevel) { return true; } } if (!parents.isEmpty()) { CompositePackagingElement<?> lastParent = parents.get(parents.size() - 1); if (lastParent instanceof ArtifactRootElement<?> && !processor.process(lastParent, currentPath, anArtifact)) { return false; } } return processParents(anArtifact, context, processor, currentPath, maxLevel, processed); } return true; }