Get version of diff code file showing methods (names)

I want to get the difference between the two versions of the code file (sort Java / C #) - and this will result in a list of methods (names). Is it implemented?

I assume that this will require an AST analysis of the strings returned from diff.

The goal of this would be to refine checkstyle / findbugs to just work on the methods affected during Sprint.

I reviewed the eclipse process for doing diff:

http://dev.eclipse.org/viewsvn/index.cgi/org.eclipse.compare.tests/src/org/eclipse/compare/tests/

It looks like it just works on line number, not AST. I'm interested in displaying the string # => methodName.

+3
source share
3 answers

You can use eclipse api comparison even without using eclipse itself. Search org.eclipse.compare

+1
source

I don’t know if this will help / can help you, but diff / compare in Eclipse does it in the top panel (below it is two files / versions side by side). Graphic, yes, but maybe there is an API somewhere for "public" use?

+1
source

Dunno, - .

, , , + call, , SAM , , "" .

DMS Java / , " ". (, , , Get Set .. , ). , "", . , API.

An alternative would be to apply the SD "Smart Diff" to the pairs of Java files that you know are the original and modified version. He compares AST and finds minimal changes to compare with each other. If the old and new methods are exactly the same, he will detect this and tell you how to edit to get another. See http://www.semdesigns.com/Products/SmartDifferencer/index.html

0
source

Source: https://habr.com/ru/post/1709009/


All Articles