gumtree-spoon-ast-diff
gumtree-spoon-ast-diff copied to clipboard
Bug on ActionClassifier and Moves
Problematic:
The ActionClassifier groups Moves into Root Action moves as done with Insert and Actions (The code is almost the same see here ) However, Moves are different from Inserts/Deletes: a move affects to a Tree, whereas Insert/delects affects to a single node. This means that, for example, if we move a While, we always only one Move action. But, if we add one While we have N actions (Insert of condition, insert of body, insert of statements inside body, etc). This means that the classifiers wrongly works when we move element X to element Y, and Y is a leaf of another moved tree Z (Z having more than 1 level). In that case, the classifier produces two roots: mov X and Mov Z. Note that the behaviour is correct if Z is a single node (and is also leaf i.e. Y )
For example:
method a(){
- call1()
....
- if(a){
- call2()
- }
}
method b(){
+ if(a){
+ call1()
+ call2()
+}
}
Produce two moves: Mov If(a) and Mov call1()
Solutions:
I propose two solutions.
First, I would not group moves. Moved nodes are already grouped, because only the root is marked as moved. Second, to check in the complete list of parent if there is a moved parent, rather than only in the immediate parent.