New candidate JEP: 492: Flexible Constructor Bodies (Third Preview)

Mark Reinhold mark.reinhold at oracle.com
Wed Oct 2 13:14:32 UTC 2024


https://openjdk.org/jeps/492

  Summary: In constructors in the Java programming language, allow
  statements to appear before an explicit constructor invocation, i.e.,
  super(..) or this(..).  The statements cannot reference the instance
  under construction, but they can initialize its fields.  Initializing
  fields before invoking another constructor makes a class more reliable
  when methods are overridden.  This is a preview language feature.

- Mark


More information about the jdk-dev mailing list