“错误顺序的变量访问定义”是什么意思? Checkstyle 中的意思是什么?
我在我的 Java 代码上运行 checkstyle 并收到此错误:
变量访问定义的顺序错误
有人能告诉我这意味着什么吗?
I run checkstyle on my Java code and get this error:
variable access definition in wrong order
Can somebody tell me what that means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
难道是你在CheckStyle中配置了声明顺序?看看
http://checkstyle.sourceforge.net/config_coding.html#DeclarationOrder
在该链接中,你会注意到它说...
*根据 Java 编程语言的代码约定,类或接口声明的各个部分应按以下顺序出现:
类(静态)变量。
首先是公共类变量,
然后是受保护的,
然后是包级别(无访问修饰符),以及
然后是私人的。
实例变量。
首先是公共类变量,
然后是受保护的,
然后是包级别(无访问修饰符),以及
然后是私有构造函数*
Could it be that you have declaration order configured in CheckStyle? Take a look at
http://checkstyle.sourceforge.net/config_coding.html#DeclarationOrder
In that link, you will notice that it says ...
*According to Code Conventions for the Java Programming Language , the parts of a class or interface declaration should appear in the following order:
Class (static) variables.
First the public class variables,
then the protected,
then package level (no access modifier), and
then the private.
Instance variables.
First the public class variables,
then the protected,
then package level (no access modifier), and
then the private Constructors Methods*
也许回答这个问题有点晚了,但就我而言,我遇到了类似的事情:
在我将顺序更改为:
我的问题解决了。
Maybe it is a little late for answering this question but in my case i had some thing like that:
and after i changed the order to:
my problem solved.
我猜你有类似
static public int
的东西。通常,它会被写为public static int
。I'm guessing you have something like
static public int
. Normally, that would be written aspublic static int
.