This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user