Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about root operations in an edit script #147

Open
algomaster99 opened this issue Mar 9, 2021 · 4 comments
Open

Question about root operations in an edit script #147

algomaster99 opened this issue Mar 9, 2021 · 4 comments

Comments

@algomaster99
Copy link
Member

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?

@martinezmatias
Copy link
Contributor

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

@algomaster99
Copy link
Member Author

@martinezmatias sure, I will submit a pull request for that.

@martinezmatias
Copy link
Contributor

great, thanks!

@martinezmatias
Copy link
Contributor

The potential solution of this issue triggest another one: #149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants