gumtree-spoon-ast-diff
gumtree-spoon-ast-diff copied to clipboard
Question about root operations in an edit script
I had a doubt about how the diff algorithm works. I calculated the diff between these two files:
prev.java
class UpdateMe { }
new.java
class Updated {
public void main(String[] args) {
int j = 0;
for (j++; j<10;++j) {
System.out.println(j);
}
int k = 0;
}
}
The diff operations between them was:
Update Class at UpdateMe:1
class UpdateMe {} to class Updated {
public void main(java.lang.String[] args) {
int j = 0;
for (j++; j < 10; ++j) {
java.lang.System.out.println(j);
}
int k = 0;
}
}
The output (printed from getRootOperations) shows only the Update operation. I expected that it would also show an Insert operation as a method has been added in the class. Is this the intended behaviour or is it supposed to be a bug?
Hi @algomaster99
Yes, it's probably a bug. It should also be an Insert op, even in the root operation list. Could you create a test case that exposes the incorrect behaviour? Thanks Matias
@martinezmatias sure, I will submit a pull request for that.
great, thanks!
The potential solution of this issue triggest another one: #149