Collection<GradleImprovedHotswapOutput> (File file) { try { String content = FileUtil.loadFile(file); Iterator<String> lines = Arrays.stream(splitByLines(content, true)) .filter(line -> !line.isBlank()) .iterator(); List<GradleImprovedHotswapOutput> outputs = new ArrayList<>(); while (lines.hasNext()) { String root = lines.next(); if (!lines.hasNext()) { LOG.error("Expected Gradle Hotswap output to contain even number of lines"); LOG.debug("Gradle Hotswap output file:\n{}", content); break; } String path = lines.next(); if (root.startsWith(ROOT_PREFIX) && path.startsWith(PATH_PREFIX)) { outputs.add(new GradleImprovedHotswapOutput( root.substring(ROOT_PREFIX.length()), path.substring(PATH_PREFIX.length()) )); } else { LOG.error(String.format("Unexpected Gradle Hotswap output format. " + "Expected '%s' to start with '%s' and '%s' to start with '%s'", root, ROOT_PREFIX, path, PATH_PREFIX)); } } return outputs; } catch (IOException e) { LOG.warn("Can not load temp file with collected Gradle tasks output paths", e); return Collections.emptyList(); } }