gumtree-spoon-ast-diff
gumtree-spoon-ast-diff copied to clipboard
not able to handle one case of ExplicitConversion
For example, run this
@Test
public void testExplicitConversion() throws Exception {
AstComparator comparator = new AstComparator();
String a = "class Foo{public void bar(){\ndouble b = 0;\n}}";
String b = "class Foo{public void bar(){\ndouble b = (double) 0;\n}}";
Diff diff = comparator.compare(a, b);
List<Operation> operations = diff.getRootOperations();
for (Operation operation : operations) {
System.out.println(operation);
System.out.println("================");
}
a = "class Foo{public void bar(){\nint a = 1;\ndouble b = a;\n}}";
b = "class Foo{public void bar(){\nint a = 1;\ndouble b = (double) a;\n}}";
diff = comparator.compare(a, b);
operations = diff.getRootOperations();
for (Operation operation : operations) {
System.out.println(operation);
System.out.println("================");
}
}
and we only get
Update Literal at Foo:2
0 to ((double) (0))
================
I also tried the webdiff tool from gumtree and did not meet this issue.
Thanks Jian for the bug report. Could you try to make a fix in a pull request?
I am going to handle this in Summer
great!