发布于 2014-09-04 03:50:06 | 252 次阅读 | 评论: 0 | 来源: 网友投递
PMD Java代码检查工具
PMD是一种开源分析Java代码错误的工具。与其他分析工具不同的是,PMD通过静态分析获知代码错误。也就是说,在不运行Java程序的情况下报告错误。PMD附带了许多可以直接使用的规则,利用这些规则可以找出Java源程序的许多问题。此外,用户还可以自己定义规则,检查Java代码是否符合某些特定的编码规范。
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 5.1.3 发布,此版本现已提供下载,更新内容如下:
Bug 修复:
#1156: False failure with “Avoid unused private methods”
#1187: double variable with AvoidDecimalLiteralsInBigDecimalConstructor
#1228: UnusedPrivateMethod returns false positives
#1230: UseCollectionIsEmpty gets false positives
#1231: No Error Message on Missing Rule
#1233: UnusedPrivateMethod: False positive : method called on returned object.
#1234: Unused private methods still giving false positives in 5.1.3 snapshot
#1235: scope dependencies in POM file
#1239: StackOverflowError in AbstractTokenizer.parseString running CPD on >1MB JS file
#1241: False+ AvoidProtectedMethodInFinalClassNotExtending
#1243: Useless Parentheses False Positive
#1245: False Positive for Law of Demeter
#1246: False positive from MissingBreakInSwitch
#1247: Not able to recognize JDK 8 Static Method References
#1249: Regression: UnusedPrivateMethod from 5.0.5 to 5.1.2
#1250: Method attribute missing for some violations
#1251: UnusedPrivateMethod false positives for boxing & unboxing arguments
新特性和改进:
#1232: Make ShortClassName configurable
#1244: FieldDeclarationsShouldBeAtStartOfClass and anonymous classes
New/Modified Rules:
FieldDeclarationsShouldBeAtStartOfClass (ruleset java-design) has a new property called ignoreAnonymousClassDeclarations: Ignore Field Declarations, that are initialized with anonymous class declarations. This property is enabled by default. See feature #1244.
ShortClassName (ruleset java-naming) has a new property called minimum: Number of characters that are required as a minimum for a class name. By default, 5 characters are required - if the class name is shorter, a violation will be reported. See feature #1232.