package org.minimallycorrect.javatransformer.internal;

import lombok.SneakyThrows;
import lombok.ToString;
import lombok.val;

import java.nio.file.*;
import java.util.*;
import java.util.zip.*;

@ToString
public class SearchPath {
	final List<Path> directories = new ArrayList<>();
	final Set<String> paths = new HashSet<>();

	@SneakyThrows
	public SearchPath(Iterable<Path> paths) {
		for (Path path : paths)
			if (Files.isDirectory(path))
				directories.add(path);
			else if (Files.isRegularFile(path))
				try (val zis = new ZipInputStream(Files.newInputStream(path))) {
					ZipEntry e;
					while ((e = zis.getNextEntry()) != null)
						this.paths.add(e.getName());
				}

	}

	public boolean exists(String s) {
		String name = s.replace('.', '/') + ".java";
		if (paths.contains(name))
			return true;
		for (Path directory : directories)
			if (Files.exists(directory.resolve(name)))
				return true;
		return false;
	}
}

@@ -81,32 +81,8 @@
 ws;%0A
-import lombok.ToString;%0A
 impo
@@ -170,18 +170,8 @@
 *;%0A%0A
-@ToString%0A
 publ
@@ -286,16 +286,46 @@
 Set%3C%3E();
+%0A%09final List%3CPath%3E inputPaths;
 %0A%0A%09@Snea
@@ -356,16 +356,12 @@
 ath(
-Iterable
+List
 %3CPat
@@ -372,16 +372,38 @@
 aths) %7B%0A
+%09%09inputPaths = paths;%0A
 %09%09for (P
@@ -649,17 +649,125 @@
 != null)
+ %7B
 %0A
+%09%09%09%09%09%09val name = e.getName().toLowerCase();%0A%09%09%09%09%09%09if (name.endsWith(%22.class%22) %7C%7C name.endsWith(%22.java%22))%0A%09
 %09%09%09%09%09%09th
@@ -797,18 +797,106 @@
 ));%0A%09%09%09%09
+%09
 %7D%0A
+%09%09%09%09%7D%0A%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09return %22SearchPath: %22 + inputPaths;
 %0A%09%7D%0A%0A%09pu

Make SearchPath.toString less verbose