2

Is there any diff tool specifically for Java that doesn't just highlight differences in a file, but is more complex?

By more complex I mean it'd take 2 input files, the same class file of different versions, and tell me things like:

  • Field names changed
  • New methods added
  • Deleted methods
  • Methods whose signatures have changed
  • Methods whose implementations have changed (not interested in any more detail than that)

Done some Googling and can't find anything like this...I figure it could be useful in determining whether or not changes to dependencies would require a rebuild of a particular module.

Thanks in advance

Edit:

I suppose I should clarify:

I'm not bothered about a GUI for the tool, it'd be something I'm interested in calling programmatically.

And as for my reasoning:

  • To workout if I need to rebuild certain modules/components if their dependencies have changed (which could save us around 1 hour per component)... More detailed explanation but I don't really see it as important.
  • To be used to analyse changes made to certain components that we are trying to lock down and rely on as being more stable, we are attempting to ensure that only very rarely should method signatures change in a particular component.
Dimitris
  • 3,975
  • 5
  • 25
  • 27
Ed .
  • 6,373
  • 8
  • 62
  • 82
  • It's easy to do with a version control system like Subversion or Git. I don't see how or why you'd want to feed that info into Maven. Why wouldn't you just want to rebuild every time? – duffymo Jul 26 '12 at 09:57
  • Yeah, so I know that there are text diff tools that I could be using but I'm more interested in a library that reports the differences listed above which can then be called upon to ascertain what to build. As to why I want to know this, my reasoning would take a while to explain and I guess hopefully it won't affect answers. Thanks. – Ed . Jul 26 '12 at 10:02
  • Don't know of one. Still can't see any good reason to do it. Shaving a few seconds off an automated build would seem like a waste of time to me. – duffymo Jul 26 '12 at 10:05
  • 1
    http://stackoverflow.com/questions/1664823/detecting-api-changes-evolution – Walter Laan Jul 26 '12 at 10:10
  • That's what I'm looking for! Thanks, if you want to post as an answer I'd accept. – Ed . Jul 26 '12 at 10:14
  • @Ed. Not surprisingly all such tools were abandoned >5 years ago. You should do it with test cases and don't rely on some magic tools which should figure out something. E.g., the "implementation changed" is nearly impossible to detect. A method body could be unchanged, but, say, 3rd party library version was updated and it could cause failures in the method. So, just write test cases. – kan Jul 26 '12 at 11:52
  • @kan Yeah, fair point - I guess implementation changes were a bit ambitious! – Ed . Jul 26 '12 at 12:10

1 Answers1

1

You said above that Clirr is what you're looking for.

But for others with slightly differet needs, I'd like to recommend JDiff. Both have pros and cons, but for my needs I ended up using JDiff. I don't think it'll satisfy your last bullet point and it's difficult to call programmatically. What it does do is generate a useful report for API differences.

Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356