[lworld] Javac accepts field initializer that refers to a superclass field

XMLWordPrintable

      Javac accepts this code:
      abstract value class ValueParent {
          int b = 5;
      }

      value class ValueClass extends ValueParent {
          int a = b;
      }

      according to the spec this should be rejected as the initializer will run in the prologue phase and there is a reference to a super class field. If ValueClass is modified to the "equivalent" version below, javac does issue an error:

      value class ValueClass extends ValueParent {
          int a;

          ValueClass() {
              a = b;
              super();
          }
      }

      reported by Ella Ananeva

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Vicente Arturo Romero Zaldivar
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: