JVM Knowledge

Let C be a class declared within the scope of V. Then:

  • V is definitely assigned before an enum constant (§8.9.1) or static variable initializer (§8.3.2) of C iff V is definitely assigned before the declaration of C.

    Note that there are no rules that would allow us to conclude that V is definitely unassigned before a static variable initializer or enum constant. We can informally conclude that V is not definitely unassigned before any static variable initializer of C, but there is no need for such a rule to be stated explicitly.

Let C be a class, and let V be a blank static final member field of C, declared in C. Then:

  • V is definitely unassigned (and moreover is not definitely assigned) before the leftmost enum constant, static initializer (§8.7), or static variable initializer of C.
  • V is [un]assigned before an enum constant, static initializer, or static variable initializer of C other than the leftmost iff V is [un]assigned after the preceding enum constant, static initializer, or static variable initializer of C.

Let C be a class, and let V be a blank static final member field of C, declared in a superclass of C. Then:

  • V is definitely assigned (and moreover is not definitely unassigned) before every enum constant of C.
  • V is definitely assigned (and moreover is not definitely unassigned) before the block that is the body of a static initializer of C.
  • V is definitely assigned (and moreover is not definitely unassigned) before every static variable initializer of C.