如何解决checkstyle_error.xml错误 [英] how to resolve checkstyle_error.xml errors
问题描述
在我的项目中,checkstyle_error.xml显示此错误参数角色应为final。
In my project checkstyle_error.xml shows this error Parameter role should be final.
for public void setRole(String role){
但我不知道为什么它应该是final。
并且可能会有更多的空格和制表符相关的错误。任何人都可以告诉我为什么会这样。任何一个很好的教程来查找checkstyle错误约定。
for public void setRole(String role) {
but i am not getting why it should be final.
And may more space and tab char related error. can any one tell me why is this. any good tutorial to find checkstyle error convention.
我有一些更多的错误是:
some more errors i got are:
1. Unused @param tag for 'Integer'
/**
* Sets id.
* @param Integer id
*/
public void setId(Integer id) {
this.id = id;
}
2. Expected @param tag for 'id&apos
public void setId(Integer id) {
this.id = id;
}
推荐答案
-
每当您不明白checkstyle错误消息时,请查看支票列表可能有帮助,例如有关空白的规则。
为什么要使用最终参数:
这是一种方便的方法来防止错误地更改参数值的隐藏错误。一般来说,简单的方法是更好的保护这一类错误的方法,但最终的参数可以作为编码风格的有用补充。
It's a handy way to protect against an insidious bug that erroneously changes the value of your parameters. Generally speaking, short methods are a better way to protect from this class of errors, but final parameters can be a useful addition to your coding style.
-
为什么你不想使用标签字符:
开发人员不需要配置标签宽度他们的文本编辑器,以便能够读取源代码。
Developers should not need to configure the tab width of their text editors in order to be able to read source code.
-
如何写Javadoc评论 1:
@param id你的评论在这里
而不是@param Integer id
。错误消息说,当没有这样的参数时,有一个名为Integer
的参数的@param
标签。 How to write Javadoc comments 1:
@param id your comment goes here
instead of@param Integer id
. The error message says that there is a@param
tag for a parameter calledInteger
, when there is no such parameter.如何编写Javadoc注释2:您的方法缺少任何Javadoc,特别是
@param
对于id
参数(这是错误消息说的)。How to write Javadoc comments 2: Your method is missing any Javadoc, especially a
@param
tag for theid
parameter (that's what the error message says).这篇关于如何解决checkstyle_error.xml错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!