重複の可能性:
列挙型初期化子内の静的フィールドにアクセスできません
私の状況:
enum Attribute { POSITIVE, NEGATIVE }
enum Content {
    C1(Attribute.POSITIVE),
    C2(Attribute.POSITIVE),
    ... // some other positive enum instances.
    Cm(Attribute.NEGATIVE),
    ... // some other negative enum instances.
    Cn(Attribute.NEGATIVE);
    private final Atrribute a;
    static int negativeOffset = 0;
    private Content(Atrribute a) {
        this.a = a;
        if ( a.compareTo(Attribute.POSITIVE) == 0 ) {
               negativeOffset ++;
        }
    }
    public static int getNegativeOffset() { return negativeOffset; }
} 
私の意図は、新しい列挙型 (POSITIVE 属性を持つ) を追加するたびに、negativeOffset を 1 つずつ追加することです。その後、getNegativeOffset() を呼び出して、負の列挙型の開始点を取得し、必要なことを行うことができます。
しかし、comlier は次のように不満を述べています。
Cannot refer to the static enum field Content.negativeOffset within an initializer