m-zakeri/CodART

Push Down Method: Not Working!

seyyedaliayati opened this issue · 0 comments

Describe the bug
I defined a new package with three classes: Unit, Tank, Soldier:
push_down_method/Unit.java:

package push_down_method;

public class Unit {
    public int getFuel(){
        System.out.println("push_down_method.Unit.getFuel()");
        return 25;
    }
}

push_down_method/Tank.java:

package push_down_method;

public class Tank extends Unit {
    
}

Soldier is also an empty class.
I moved want to move getFuel() to Tank.java but I couldn't. The code just removed it from Unit.java but did not move it to Tank.java,
Here is my main config:

my_list = get_filenames_in_dir('/home/ali/Desktop/JavaTestProject/src/')
    print("Testing pushdown_method...")
    if PushDownMethodRefactoring(my_list, "push_down_method", "Unit", "getFuel", ["Tank", "Soldier", ]).do_refactor():
        print("Success!")
    else:
        print("Cannot refactor.")

File Path
refactorings/pushdown_method2.py