Diff tool that compares methods directly (ignores reordering)?

Let's say I have this source file that has been modified:

Before:

public class MyClass {
    public void bar() {
        System.out.println("bar");
    }

    public void foo() {
        System.out.println("foo");
    }
}

      

After:

public class MyClass {
    public void foo() {
        System.out.println("foobar");
    }

    public void bar() {
        System.out.println("bar");
    }
}

      

Most diff tools report that the old foo method was removed and a new foo method was added when in reality it was simply moved to a different location and updated. Are there any comparison tools that can intelligently recognize that a method has been moved and compare different sections of the method, instead of reporting that the entire section of code has been removed or added?

+3


source to share





All Articles