List<Long> (File rootFile, BuildTarget<?> target) { try { if (!rootFile.exists()) { return null; } List<Long> targetRootHashes = new ArrayList<>(); Files.walkFileTree(rootFile.toPath(), EnumSet.of(FileVisitOption.FOLLOW_LINKS), Integer.MAX_VALUE, new SimpleFileVisitor<>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { String filePathString = path.toString(); if (filePathString.endsWith(".class")) { Long calculatedHash = myCalculatedHashes.get(filePathString); if (calculatedHash != null) { targetRootHashes.add(calculatedHash); } else { File file = path.toFile(); long hash = getOutputFileHash(file, rootFile); targetRootHashes.add(hash); myCalculatedHashes.put(filePathString, hash); } } return FileVisitResult.CONTINUE; } }); return targetRootHashes; } catch (IOException e) { LOG.warn("Couldn't calculate build target hash for : " + target.getPresentableName(), e); return null; } }