RFR: 8370687: Improve before constructor has been called error message
Chen Liang
liach at openjdk.org
Tue Oct 28 17:58:33 UTC 2025
On Mon, 27 Oct 2025 19:27:43 GMT, Chen Liang <liach at openjdk.org> wrote:
> In the Valhalla EA2 preview, Value class and record constructor body is in prologue by default, as opposed to all existing constructors and all identity constructors in EA2. This causes a confusion because the error message `cant.ref.before.ctor.called` can appear in such constructors without explicit constructor invocations.
>
> After discussion with @vicente-romero-oracle, we decide to commit this change onto mainline: these two errors never happen in constructors without explicit constructor invocation (colloquially "this" or "super" calls) on mainline, so this message update would not create new confusions. This is future-proof, and is more consistent with the related `call.must.only.appear.in.ctor` message, which is "explicit constructor invocation may only appear within a constructor body".
Thanks for the reviews!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28007#issuecomment-3457778801
More information about the compiler-dev
mailing list