代码规范
雨临Lewis
个人博客地址:https://lewky.cn
展开
-
PMD笔记-Overridable method 'XXX' called during object construction
PMD错误 Overridable method ‘XXX’ called during object construction样例public class Test { public int a; public Test() { test(); } public void test() { a = 10; }}报错原因不要原创 2018-03-13 14:23:59 · 1701 阅读 · 0 评论 -
PMD笔记-Avoid reassigning parameters such as 'XXX'
在用PMD检测代码时发现报错如下: Avoid reassigning parameters such as ‘col’. Reassigning values to incoming parameters is not recommended. Use temporary local variables instead.报错的代码如下: private BaseCo...原创 2018-03-08 16:42:57 · 4160 阅读 · 0 评论 -
PMD笔记-Avoid if (x != y) ..; else ..;
PMD错误 Avoid if (x != y) ..; else ..;样例public class Test { public int a = 1; public static void main(final String[] args) { final Test test = new Test(); if (test.a != 1) {原创 2018-03-13 14:34:25 · 1231 阅读 · 0 评论 -
Eclipse笔记-PMD插件
PMD是一种静态解析Java代码错误的工具,可以在不运行Java程序的情况下对Java代码进行分析并报告错误。Eclipse的PMD插件自带了许多规则(并不是所有规则都是合理的,有的规则报告的错误可以无视),也可以自己制定规则并导入。Eclipse在线安装插件1、Help -> Install New Software… -> Add… 2、填写地址 http://sou...原创 2018-03-28 23:22:06 · 10618 阅读 · 0 评论 -
PMD - Avoid autogenerated methods to access private fields and methods of inner / outer classes
PMD错误Avoid autogenerated methods to access private fields and methods of inner / outer classes样例public class Test {public static void main(final String[] args) {//code}public void te...原创 2018-08-23 23:32:55 · 579 阅读 · 0 评论