Incorrect declare-before-use for enum constants

Issue #160 resolved
Jesper Öqvist created an issue

ExtendJ 8.0.1-101-gf92bc19

Enum constants are always declared before being used after the enum constant part of an enum declaration.

Test case:

// Enum constants can be used in a static context.
// .result=COMPILE_PASS
enum Test {
  O1, O2, O3;

  static {
    System.err.println(O1);
  }
}

ExtendJ error:

    [junit] tests/enum/static_02p/Test.java:7,24: error: variable O1 is used in static {
    [junit]   System.err.println(O1);
    [junit] } before it is declared

Comments (1)

  1. Log in to comment