use of gumtree.spoon.AstComparator in project dspot by STAMP-project.
the class SelectorOnDiff method getModifiedMethod.
@SuppressWarnings("unchecked")
private static Set<CtMethod> getModifiedMethod(String pathFile1, String pathFile2) {
try {
final File file1 = new File(pathFile1);
final File file2 = new File(pathFile2);
if (!file1.exists() || !file2.exists()) {
return Collections.emptySet();
}
Diff result = (new AstComparator()).compare(file1, file2);
return result.getRootOperations().stream().map(operation -> operation.getSrcNode().getParent(CtMethod.class)).collect(Collectors.toSet());
} catch (Exception ignored) {
// if something bad happen, we do not care, we go for next file
return Collections.emptySet();
}
}
Aggregations