Checkstyle的结果输出
2011-08-26 20:29
197 查看
序号 输出内容意义
1 Type is missing a javadoc commentClass 缺少类型说明
2“{” should be on the previous line “{” 应该位于前一行
3Methos is missing a javadoc comment方法前面缺少javadoc注释
4Expected @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 suggestionFinal 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.
解释:代码写法,习惯不一样。
需要检查,仅仅提示。
相关文章推荐
- checkStyle结果分析序号输出内容意义
- Java代码检查工具Checkstyle常见输出结果
- Checkstyle常见输出结果
- Checkstyle配置文件及常见输出结果
- mybatis执行查询语句查询不到结果,控制台输出sql语句复制到数据库中能查到数据
- A Bug's Life 并查集,很好的应用,假定同性的放入一个集合中,矛盾时输出结果;
- 4.编程实现k-means算法,针对下表数据,在给定k=3的情况下,输出聚类结果。
- 存储过程的输出参数,返回值与结果集
- java调用C的exe文件并传入参数,读出exe输出结果
- 执行控制台程序并且获得它的输出结果
- c语言:编一个统计选票的程序,先后输入被选人的名字,最后输出各人得票结果
- oracle的asciistr函数惹祸了(在9i和10g上运行输出结果不一致)
- int转换成byte打印输出结果探讨
- python dataframe 输出结果整行显示
- [java]输入一个算术表达式输出结果
- 根据先序遍历和中序遍历输出层次遍历的结果
- 从Linux程序中执行shell(程序、脚本)并获得输出结果(转)
- 接口调用,输出结果为Json格式(ConvertTo-Json),提交参数给URL(WebRequest)
- “写出printf的输出结果”——你能看到什么?
- MySql数据库查询结果用表格输出PHP代码示例