Which is the best tool for finding bugs in the Java code? [closed]

匆匆过客 提交于 2019-12-20 15:25:14

问题


I would like to know which tool is best for finding any kind of bugs in my code. I know this may be some what theoretical or never ending question so I would like to modify it in terms of the efficiency of bug reporting (including the naming convention as well). So you can say which tool reports and maximum bugs and if effectively used in the industry? I heard about findbug is it really good?


回答1:


FindBugs is probably one of the most prominent ones and well worth a try.

For naming conventions etc, I'd suggest you have a look at CheckStyle.




回答2:


Findbugs is quite good. However, I would recommend using sonar to maintain code quality. http://www.sonarsource.org/ It integrates well with maven (sonar:sonar). Other than this I believe the use of maven site to create checkstyle, pmd, findbugs et-all report also helps keep the developers on toes.




回答3:


It depends on what you are looking for. Personally, I use a combination of FindBugs and PMD for performing static analysis of Java code. However, I recently discovered an Eclipse plugin called CodePro Analytix by Google.

There are two types of analysis for Java code - source code analysis and byte code analysis. PMD looks at the source code to find possible bugs, unused code, suboptimal code, complicated expressions, and duplicated code. FindBugs looks at the generated byte code to find possible errors. Both are essential when analyzing an application.

However, when it comes to finding defects, nothing beats a good testing framework and (if necessary) a mocking library. I've had good successes with JUnit and Mockito. This will enable you to write unit tests for your modules. Writing code system, integration, and smoke tests, either using automated tools or test procedures is also important so that you can cover core functionality and quickly see when something is broken.




回答4:


I prefer to use the Code Analysis in IntelliJ. It not only finds many probable bugs and improvement but has quick fixes for a lot them which makes it practical to fix large amounts of code.




回答5:


use a compiler to find syntax 'bugs'

use test cases to find usability 'bugs'

use test harnesses in the code to find regression issues with code modifications.



来源:https://stackoverflow.com/questions/7321282/which-is-the-best-tool-for-finding-bugs-in-the-java-code

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