« * K @scordio.github.io

Stefano Cordio @scordio.github.io

2026-08-23 09:19 UTC

TIL you cannot access non-constant static fields in an enum constructor (JLS §8.9.2), unlike in a standard class. This is because enum constructors run during enum class initialization, while non-constant fields are initialized later, creating a forward reference. docs.oracle.com/javase/specs...

1 picture (not shown on this phone): JLS §8.9.2 excerpt: "It is a compile-time error to refer to a static field of an enum class from a constructor, instanc…

0 likes, 0 reposts, 0 replies

3 Next post4 More from @scordio.github.ioBackBluesky home
☆ Save to home · 0 Home · Find · Games · Chat · AI · Setup