Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java checkstyle-构造函数定义顺序错误_Java_Checkstyle - Fatal编程技术网

Java checkstyle-构造函数定义顺序错误

Java checkstyle-构造函数定义顺序错误,java,checkstyle,Java,Checkstyle,我有一个类似这样的类: public final class OrderedSetList<T extends Comparable<? super T>> implements OrderedSet<T> { // Constructor definition in wrong order checkstyle error next line public OrderedSetList() { // Initia

我有一个类似这样的类:

public final class OrderedSetList<T extends Comparable<? super T>> implements OrderedSet<T> {

    // Constructor definition in wrong order checkstyle error next line
    public OrderedSetList() {      
        // Initializations
    }
}
public final类OrderedSetList确保您遵循声明顺序的代码约定:

类或接口声明的部分应按以下顺序显示:
类(静态)变量。首先是公共类变量,然后是受保护的,然后是包级别(无访问修饰符),然后是私有的
实例变量。首先是公共类变量,然后是受保护的,然后是包级别(无访问修饰符),然后是私有的
构造函数
方法


它希望构造函数是第一个方法。

构造函数是第一个方法吗?@Glitch Nope。这是一个问题吗?我认为checkstyle规则希望构造函数作为第一个方法。尝试将其上移到变量的正下方。@Glitch感谢您问题已解决!您还应该引用checkstyle规则,有几点不需要复制。