feat: 完成二阶段的优化处理
All checks were successful
缓存序列化结构检查 / cache-schema-check (push) Has been skipped

This commit is contained in:
2026-07-14 15:49:40 +08:00
parent 875a5edbd1
commit cab3fea666
17 changed files with 623 additions and 118 deletions

View File

@@ -31,22 +31,24 @@ public class FileScanner {
public Map<String, String> scan() {
Map<String, String> result = new LinkedHashMap<>();
try (Stream<Path> stream = Files.walk(repoRoot)) {
stream.filter(Files::isRegularFile)
List<Path> javaFiles = stream
.filter(Files::isRegularFile)
.filter(p -> p.toString().endsWith(".java"))
.forEach(p -> {
.filter(p -> {
String rel = repoRoot.relativize(p).toString().replace('\\', '/');
if (!rel.contains("/src/main/java/")) {
return;
}
if (!moduleAllowed(rel)) {
return;
}
try {
result.put(rel, new String(Files.readAllBytes(p), StandardCharsets.UTF_8));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
return rel.contains("/src/main/java/") && moduleAllowed(rel);
})
.collect(java.util.stream.Collectors.toList());
javaFiles.parallelStream().forEach(p -> {
String rel = repoRoot.relativize(p).toString().replace('\\', '/');
try {
synchronized (result) {
result.put(rel, new String(Files.readAllBytes(p), StandardCharsets.UTF_8));
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
});
} catch (IOException e) {
throw new UncheckedIOException(e);
}