加入了开源大军,提交代码时需要ant checkstyle,这里将ant checkstyle过程中遇到的问题整理下来.方便自己也方便别人.
1.First sentence should end with a period
第一句应该以句号(.)结束,如
/**
* util,to parse sql
*
*/
util.to parse sql后面没有句号而报错
2.Utility classes should not have a public or default constructor.
实用工具类不应该有一个默认的公共的构造函数.由于任何类都有默认的公共的无参构造函数,所以这里要在代码中加上一个私有的构造函数,如下:
private class YourClass(){ }
3.Class ParseSQLUtil should be declared as final.
类ParseSQLUtil应该定义为final类型,改正后代码如下:
public final class ParseSQLUtil{
}
4.File contains tab characters (this is the first instance).
解决方法:http://hi.baidu.com/lane727/blog/item/bd6304fb7cb48555242df27f.html
5.Line does not match expected header line of ' * Licensed to the Apache Software Foundation (ASF) under one'.
第一行要以* Licensed to the Apache Software Foundation (ASF) under one开头