4个开源的Java代码静态分析工具

1. PMD

  PMD是一款采用BSD协议发布的Java程序代码检查工具。该工具可以做到检查Java代码中是否含有未使用的变量、是否含有空的抓取块、是否含有不必要的对象等。该软件功能强大,扫描效率高,是Java程序员debug的好帮手。

  PMD支持的编辑器包括:

  JDeveloper、 Eclipse、JEdit、JBuilder、BlueJ、CodeGuide、NetBeans/Sun Java Studio Enterprise/Creator、IntelliJ IDEA、TextPad、Maven、Ant,、Gel、JCreator和Emacs。

PMD for Eclipse install instructions

  1. Start Eclipse.
  2. Start the installation procedure : select the Help>Software Updates>Find and Install... menu item.
  3. Select "Search for new features to install" option and click Next.
  4. Click New Remote Site...
  5. Give a name (ie PMD Eclipse Site), enter the URL http://pmd.sourceforge.net/eclipse
  6. Select this new site in the Sites to include in search list and click Next.
  7. Select PMD for Eclipse 3 and Apache Xerces in the "Select the features to install" list and click Next.
  8. Accept the terms of the license agreements and click Next.
  9. Verify that the install location is your Eclipse installation directory, otherwise select the correct one, click Finish.
  10. A warning appear telling the feature is not signed. Ignore and click Install to continue.
  11. Accept to restart the workbench to load PMD into the workbench.

Eclipse is restarted and a PMD welcome page is displayed : the plugin is correctly installed.


  2. FindBugs

  FindBugs是一个能静态分析源代码中可能会出现Bug的Eclipse插件工具。它也可以分析被编译过的程序。这个工具已经被下载了超过70万次。

  3. JLint

  Jlint 可以帮助你检查 Java 代码找出 Bug,不一致和同步问题。JLint 运行非常快速,即使你的项目非常大,它也只需要几秒钟就能检查所有的类。Jlint 已经成功的商业环境中应用。

  4. Checkstyle

  Checkstyle 是一个用来帮助开发者编写符合编码标准的代码的工具。它是高度可以配置的,几乎可以支持任何编码标准。它也可以用来帮助发现类的设计问题,重复代码,问题代码等等。这个工具可以和 Ant 整合。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值