boolean (File file) { final JavaSourceRootDescriptor rd = myBuildRootIndex.findJavaRootDescriptor(myContext, file); if (rd == null) { return true; } final BuildTarget<?> targetOfFile = rd.target; if (myChunkTargets.contains(targetOfFile)) { return true; } Set<BuildTarget<?>> targetOfFileWithDependencies = myCache.get(targetOfFile); if (targetOfFileWithDependencies == null) { targetOfFileWithDependencies = Iterators.collect(Iterators.recurseDepth(targetOfFile, new Iterators.Function<BuildTarget<?>, Iterable<? extends BuildTarget<?>>>() { @Override public Iterable<? extends BuildTarget<?>> fun(BuildTarget<?> t) { return myBuildTargetIndex.getDependencies(t, myContext); } }, false), new LinkedHashSet<>()); myCache.put(targetOfFile, targetOfFileWithDependencies); } return ContainerUtil.intersects(targetOfFileWithDependencies, myChunkTargets); }