Set<String> (@NotNull Element root, @Nullable PathMacroFilter filter, @NotNull PathMacrosImpl pathMacros) { PathMacrosCollector collector = new PathMacrosCollector(); collector.substitute(root, true, false, filter); Set<String> preResult = collector.myMacroMap.keySet(); if (preResult.isEmpty()) { return Collections.emptySet(); } Set<String> result = new HashSet<>(preResult); result.removeAll(pathMacros.getSystemMacroNames()); result.removeAll(pathMacros.getLegacyMacroNames()); pathMacros.removeToolMacroNames(result); result.removeAll(pathMacros.getIgnoredMacroNames()); return result; }