Need a Java and Javascript diff tool written in Java

筅森魡賤 提交于 2019-12-13 03:57:03

问题


We need an accurate diff utility for Java and Javascript files, written in Java. It should be invokable from within an Eclipse (version 3.2 or 3.3) application. Preferably we need the Java source code for this utility also.

The utility should be able to compare two files (old and new, say) and determine the following accurately:

  • Number of LOC added to the new file
  • Number of LOC deleted from the old file
  • Number of LOC changed in the old file
  • Number of change deltas, i.e., contiguous blocks of code added/changed/deleted.

回答1:


I needed a Java diff implementation and found this: http://javacook.darwinsys.com/javasrc/textproc/Diff.java which I adapted.




回答2:


Eclipse has a very good diff/compare plugin installed by default. Have you looked into using and/or extending that (it's opensource)? I would not think that adding some statistics reporting to the existing plug-in would be all that difficult, though sometimes plug-in development (even just simple extension) can be deceiving.

Good luck.




回答3:


See Diffj.



来源:https://stackoverflow.com/questions/954270/need-a-java-and-javascript-diff-tool-written-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!