`

FindBugs

 
阅读更多
FindBugs 是一个静态分析工具,它检查类或者 JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题。有了静态分析工具,就可以在不实际运行程序的情况对软件进行分析。不是通过分析类文件的形式或结构来确定程序的意图,而是通常使用 Visitor 模式

1. eclipse插件安装 http://findbugs.cs.umd.edu/eclipse-daily/


2. 使用







3. 例子

原始代码
else if (existingTestCase.getStatus().getStatusID() == DataStatusEnum.DELETE.getValue()) {

Findbugs报错

Bug: Suspicious comparison of Integer references in com.technicolor.utf.testdirectory.service.TestCaseService.syncFromCVS(TestCaseDto)

This method compares two reference values using the == or != operator, where the correct way to compare instances of this type is generally with the equals() method. It is possible to create distinct instances that are equal but do not compare as == since they are different objects. Examples of classes which should generally not be compared by reference are java.lang.Integer, java.lang.Float, etc.

Confidence: High, Rank: Scariest (1)
Pattern: RC_REF_COMPARISON
Type: RC, Category: CORRECTNESS (Correctness)




改正:

} else if (existingTestCase.getStatus().getStatusID().equals(DataStatusEnum.DELETE.getValue())) {
  • 大小: 55.6 KB
  • 大小: 145.6 KB
  • 大小: 184.4 KB
  • 大小: 101.8 KB
分享到:
评论

相关推荐

    findbugs-annotations-1.3.9-1-API文档-中文版.zip

    赠送jar包:findbugs-annotations-1.3.9-1.jar; 赠送原API文档:findbugs-annotations-1.3.9-1-javadoc.jar; 赠送源代码:findbugs-annotations-1.3.9-1-sources.jar; 赠送Maven依赖信息文件:findbugs-...

    findbugs 1.3.9 findbugs 1.3.9

    findbugs 1.3.9 findbugs 1.3.9 findbugs 1.3.9 findbugs 1.3.9 findbugs 1.3.9 findbugs 1.3.9

    代码检测findbugs1.3.4

    插件安装时,我们只需在eclipse根目录下新建一个【links】目录,然后在里面创建【.link】扩展名的文件,在里面写上类似于【path=F:\\IDE\\eclipsePlugin\\findbugs\\findbugs1.3.4】这样的配置信息,不就可以统一...

    findbugs3.0.2插件 myeclipse

    FindBugs 是由马里兰大学提供的一款开源 Java静态代码分析工具。FindBugs通过检查类文件或 JAR文件,将字节码与一组缺陷模式进行对比从而发现代码缺陷,完成静态代码分析。FindBugs既提供可视化 UI 界面,同时...

    SonarQube的FindBugs插件sonar-findbugs-plugin.jar,包含FindBugs Security Audit等规则

    SonarQube的FindBugs插件sonar-findbugs-plugin.jar(版本:4.0.1-SNAPSHOT),包含FindBugs Security Audit等规则,可以离线集成到sonarqube。

    findbugs-3.0.1.ta

    FindBugs是一个匹配编译代码模式,而非使用bug数据库的工具。当提供源代码时,FindBugs还可高亮显示检测出bug的代码行。 在它的3.0.1版本中,FindBugs继续保持着数以百计的bug描述。根据bug的严重程度,FindBugs将...

    findbugs-3.0.1.tar.gz

    FindBugs supports Java 8 now (both as runtime and target platform). FindBugs requires minimum Java 7 as runtime environment! FindBugs uses ASM 5 now which means that some 3rd party detectors based ...

    findbugs(3.01).zip

    FindBugs 是一个静态分析工具,它检查类或者 JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题。有了静态分析工具,就可以在不实际运行程序的情况对软件进行分析。不是通过分析类文件的形式或结构来确定...

    findbugs-2.0.1

    在这个由两部分组成的系列文章的第一部分中,高级软件工程师 Chris Grindstaff 分析了 FindBugs 如何帮助提高代码质量以及排除隐含的缺陷。代码质量工具的一个问题是它们容易为开发人员提供大量但并非真正问题的问题...

    findbugs最新源代码20081008版本的

    findbugs源代码 有喜欢研究的下载吧

    FindBugs插件-亲测可用

    解压后拿到FindBugs.zip插件,有Eclipse和IDEA的; 使用:IDEA为例--直接在idea---file--settings---plugins---Install plugin from disk 选中压缩包,点击apply--ok,重启idea即可。 使用:右击代码文件或项目,...

    findbugs-annotations-1.3.9-1-API文档-中英对照版.zip

    赠送jar包:findbugs-annotations-1.3.9-1.jar; 赠送原API文档:findbugs-annotations-1.3.9-1-javadoc.jar; 赠送源代码:findbugs-annotations-1.3.9-1-sources.jar; 包含翻译后的API文档:findbugs-...

    FindBugs JSR305_3.0.2

    FindBugs, Find Bugs in Java Programs. FindBugs requires JRE (or JDK) 1.7.0 or later to run. However, it can analyze programs compiled for any version of Java, from 1.0 to 1.8.

    最新findbugs.plugin.eclipse及源码

    在这个由两部分组成的系列文章的第一部分中,高级软件工程师 Chris Grindstaff 分析了 FindBugs 如何帮助提高代码质量以及排除隐含的缺陷。代码质量工具的一个问题是它们容易为开发人员提供大量但并非真正问题的问题...

    网络上搜集的Findbugs在Ant下的配置方法

    网络上搜集的Findbugs在Ant下的配置方法 坚决免费开放

    findbugs常见Bug以及处理办法

    根据Bug可能导致的后果,FindBugs定义了若干Bug级别,主要的级别如下所示: Bad Practice: 不好的实践 Correctness: 正确性 Experimental Internationalization: Malicious code vulnerability: 存在漏洞的有害代码...

    findbugs工具测试java实验报告

    利用findbugs工具测试java实验报告,里面有详细的测试内容和方案可以作为课程设计用 如果有帮助到了你 请给个好评谢谢

    sonar-findbugs-plugin-3.11.1.jar

    sonar自定义规则findbugs插件: 版本:3.11.1 对应soanrqube版本:7.6-8.1都可以使用该版本(即从7.6开始的sonar版本到8.1都可以使用该插件)

    IDEA插件-FindBugs-IDEA-1.0.1.rar

    IDEA插件-FindBugs-IDEA-1.0.1,威哥开发使用,决定可以用。自行导入IDEA。Findbugs是一个静态分析工具,它检查类或者JAR 文件,将字节码与一组缺陷模式进行对比以发现可能的问题。Findbugs自带检测器,其中有60余种...

    eclipse插件FindBugs错误分析说明

    主要是eclipse插件FindBugs中错误的解释说明,帮助定位错误原因

Global site tag (gtag.js) - Google Analytics