1 Type is missing a javadoc commentClass 缺少类型说明
2“{” should be on the previous line “{” 应该位于前一行
3 Methos is missing a javadoc comment 方法前面缺少javadoc注释
4 Expected @throws tag for “Exception” 在注释中希望有@throws的说明
5“.” Is preceeded with whitespace “.” 前面不能有空格
6“.” Is followed by whitespace“.” 后面不能有空格
7“=” is not preceeded with whitespace“=” 前面缺少空格
8“=” is not followed with whitespace“=” 后面缺少空格
9“}” should be on the same line “}” 应该与下条语句位于同一行
10Unused @param tag for “unused” 没有参数“unused”,不需注释
11Variable “CA” missing javadoc 变量“CA”缺少javadoc注释
12Line longer than 80characters 行长度超过80
13Line contains a tab character 行含有”tab” 字符
14Redundant “Public” modifier 冗余的“public” modifier
15Final modifier out of order with the JSL suggestion Final modifier的顺序错误
16Avoid using the “.*” form of importImport 格式避免使用“.*”
17Redundant import from the same package 从同一个包中Import内容
18Unused import-java.util.listImport 进来的java.util.list没有被使用
19Duplicate import to line 13 重复Import同一个内容
20Import from illegal package 从非法包中 Import内容
21“while” construct must use “{}” “while” 语句缺少“{}”
22Variable “sTest1” must be private and have accessor method 变量“sTest1”应该是private的,并且有调用它的方法
23Variable “ABC” must match pattern “^[a-z][a-zA-Z0-9]*$” 变量“ABC”不符合命名规则“^[a-z][a-zA-Z0-9]*$”
24“(” is followed by whitespace“(” 后面不能有空格 25“)” is proceeded by whitespace“)” 前面不能有空格
不太明白的错误解答
1. 'X' hides a field.
public class Foo
{
private int bar;
public Foo(int bar)
{
this.bar = bar;
}
public final int getBar()
{
return bar;
}
}
解释:全局private int bar;和局部public Foo(int bar)的bar变量名字重复。
此错误,可以忽略不检查。
2. Parameter X should be final.
public class Foo
{
private int bar;
public Foo(int bar)
{
this.bar = bar;
}
public final int getBar()
{
return bar;
}
}
解释:public Foo(int bar)的局部变量,被认为是不可改变的,检查需要加上final关键字定义public Foo(final int bar)
此错误,可以忽略不检查 。
3. Redundant 'X' modifier.
public interface CacheHRTreeService extends Manager {
/**
* Organization Tree
*
* @param orgDto
* @return
* @throws Exception
*/
public void setOrganization(OrganizationDTO orgDto) throws Exception;
/**
* Organization Tree
*
* @return
* @throws Exception
*/
public OrganizationDTO getOrganization() throws Exception;
......
}
解释:多余的字段。public OrganizationDTO getOrganization() throws Exception;此时public为多余的字段,因为interface定义的时候,就是public的。
需要检查。
4. - Class X should be declared as final.
解释:对于单例设计模式,要求返回唯一的类对象。但是HRFactory和ContextFactory为优化的两个类,不需求检查。
其他的单例类,依然需要进行检查。
5. Utility classes should not have a public or default constructor.
解释:工具类不必提供默认的构造方法。
需要检查,仅仅为提示。
6. File does not end with a newline.
解释:虽然JAVA程序不要求结尾要用新行,但是习惯上应该要空一行。
需要检查,仅仅为提示。
7. - Method 'addChildrenId' is not designed for extension - needs to be
abstract, final or empty.
解释:通过父类继承的,此类有点特殊
可以忽略此类。
8. Variable 'id' must be private and have accessor methods.
解释:BaseHRDTO类,为父类,属性给子类继承,比较特殊。
但是其他的类,声名需要加上范围'private'关键字
需要检查。
9. -Array brackets at illegal position.
解释:代码写法,习惯不一样。
需要检查,仅仅提示。