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

@@ -111,6 +111,8 @@ public class SchemaCheckAnalyzer {
List<WritePoint> newWps = detectorNew.detect(path, newContent);
List<WritePoint> oldWps = oldContent == null
? new ArrayList<>() : detectorOld.detect(path, oldContent);
newWps.forEach(this::applyManualMappings);
oldWps.forEach(this::applyManualMappings);
Map<String, WritePoint> oldBySig = new LinkedHashMap<>();
for (WritePoint wp : oldWps) {
@@ -399,12 +401,30 @@ public class SchemaCheckAnalyzer {
private SourceIndex buildIndex(Iterable<String> contents) {
SourceIndex index = new SourceIndex();
List<String> list = new ArrayList<>();
for (String content : contents) {
index.addSource(content);
list.add(content);
}
index.addSources(list);
return index;
}
private void applyManualMappings(WritePoint wp) {
String location = wp.getEnclosingClass() + "#" + wp.getEnclosingMethod();
for (CheckerConfig.ManualMapping mapping : config.getManualMappings()) {
if (mapping.getWriterMethod() == null || !mapping.getWriterMethod().equals(location)) {
continue;
}
if (mapping.getKeyPattern() != null && !mapping.getKeyPattern().isEmpty()) {
wp.setResolvedKeyPattern(mapping.getKeyPattern());
}
if (mapping.getValueType() != null && !mapping.getValueType().isEmpty()) {
wp.setResolvedValueType(mapping.getValueType());
wp.setConfidence(Math.max(wp.getConfidence(), 1.0));
}
}
}
private void collectTypeNames(String content, Set<String> out) {
if (content == null || content.isEmpty()) {
return;