private void gatherFiles(ResourceFile root, ResourceFile file, List<JavaFileObject> accumulator,
			Set<Kind> kinds, boolean recurse) {
		List<ResourceFile> listFiles = new ArrayList<>(Arrays.asList(file.listFiles()));
		listFiles.removeAll(filesToAvoid);
		for (ResourceFile resourceFile : listFiles) {
			if (resourceFile.isDirectory()) {
				if (recurse) {
					gatherFiles(root, resourceFile, accumulator, kinds, recurse);
				}
			}
			else {
				for (Kind kind : kinds) {
					if (kind == Kind.CLASS) {
						if (resourceFile.getName().endsWith(".class")) {
							accumulator.add(createFileObject(root, resourceFile, kind));
							break;
						}
					}
					else if (kind == Kind.SOURCE) {
						if (resourceFile.getName().endsWith(".java")) {
							accumulator.add(createFileObject(root, resourceFile, kind));
							break;
						}
					}
				}
			}
		}

	}
Create a {@link JavaFileManager} for use by the {@link JavaCompiler}.

@param sourceDirs the directories containing source
@param filesToAvoid known "bad" files to hide from the compiler
Ghidra/Features/Base/src/main/java/ghidra/app/script/ResourceFileJavaFileManager.java