一段简单的代码
public class HelloWorld {
public static void main(String[] args) {
int N = 10;
Integer[] x = new Integer[N]; // checkstyle error
for (int i = 0; i < N; i++)
x[i] = (Integer) i;
}
}
“不允许声明变量,返回值或'Integer'类型的参数。”
有什么想法吗?
此检查看起来像是非法类型检查套件的一部分。有人决定以不允许使用的方式配置Checkstyle Integer
。
除此之外,Integer
这里的用法是不必要的。您可以使用原语和替代项执行完全相同int
的操作int[]
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句