Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish migration to new visitor #850

Merged
merged 14 commits into from
Jan 12, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public MoveOptimizedIsomorphic() {
mappings.addMappingRecursively(src,dst);
return mappings;
}
, new IdenticalSubtreeMatcherThetaA()
, new LcsOptMatcherThetaB()
, new UnmappedLeavesMatcherThetaC()
, new InnerNodesMatcherThetaD()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ else if (src.getType().name.equals(Constants.CLASS_INSTANCE_CREATION))
ret = true;
else if (src.getType().name.equals(Constants.IMPORT_DECLARATION))
ret = true;
else if (TreeUtilFunctions.isPartOf(src, Constants.JAVA_DOC))
ret = true;
else if(src.getType().name.equals(Constants.LINE_COMMENT) || src.getType().name.equals(Constants.BLOCK_COMMENT))
ret = true;
else {
ret = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ public static String exportString(Iterable<Mapping> mappings) throws JsonProcess
public static void exportToFile(File outputFile, Iterable<Mapping> mappings) throws IOException {
List<MappingExportModel> mappingExportModels = exportModelList(mappings);
ObjectMapper objectMapper = new ObjectMapper();
if (!outputFile.exists()) {
outputFile.getParentFile().mkdirs();
outputFile.createNewFile();
}
objectMapper.writerWithDefaultPrettyPrinter().writeValue(outputFile, mappingExportModels);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ public static void writeTree(Tree tree, String filePath) {
throw new RuntimeException(e);
}
}
public static boolean isPartOf(Tree srcSubTree, String type) {
if (srcSubTree.getType().name.equals(type))
return true;
if (srcSubTree.getParent() == null) return false;
return isPartOf(srcSubTree.getParent(), type);
}

public static boolean isStatement(String type){
switch (type){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class AddCommand extends BaseCommand {
required = false)
private Set<String> files;

@Parameter(names = "-snapshot", description = "Snapshot option", required = false)
@Parameter(names = "--snapshot", description = "Snapshot option", required = false)
private boolean isSnapshot;

public boolean isSnapshot() {
Expand Down
Loading
Loading