title: How to define static constants in a Java enum?
body: <p>Is there any way to define static final variables (effectively constants) in a Java enum declaration?</p>
  
  <p>What I want is to define in one place the string literal value for the BAR(1...n) values:</p>
  
  <pre><code>@RequiredArgsConstructor
  public enum MyEnum {
      BAR1(BAR_VALUE),
      FOO("Foo"),
      BAR2(BAR_VALUE),
      ...,
      BARn(BAR_VALUE);
  
      private static final String BAR_VALUE = "Bar";
  
      @Getter
      private final String value;
  }
  </code></pre>
  
  <p>I got the following error message for the code above: <strong>Cannot reference a field before it is defined</strong>.</p>