I want to compare two methods that I think are the same, but the eclipse refactor won't make extract method from their content together.
Can I compare the two of the them using eclipse compare?
I'm using Eclipse Kepler, so depending on your version your mileage may vary.
To compare two methods in the same class, do the following:
You'll get a diff window similar to if you were comparing two files.
Update
Since answering this question, I have found a similar, but more powerful way to do this. Follow the steps above, except use the "Package Explorer" view rather than the outline view. The advantage of this is that you can choose to compare two methods that are in the same class or compare two methods that are in different classes. It's a great way to prove that two methods or subclasses are identical and can be refactored into a common shared resource.
May be you can put the two methods in different class file, and put them in Eclipse together. Then simply select them in the navigator or package explorer, right click, and click 'Compare with Each Other'.
Or you can check this question: Diff two methods in eclipse
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With