Skip to content

Conversation

@liach
Copy link
Member

@liach liach commented Oct 27, 2025

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".


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8370687: Improve before constructor has been called error message (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28007/head:pull/28007
$ git checkout pull/28007

Update a local copy of the PR:
$ git checkout pull/28007
$ git pull https://git.openjdk.org/jdk.git pull/28007/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28007

View PR using the GUI difftool:
$ git pr show -t 28007

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28007.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 27, 2025

👋 Welcome back liach! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 27, 2025

@liach This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8370687: Improve before constructor has been called error message

Reviewed-by: vromero

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Oct 27, 2025

@liach The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 27, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 27, 2025

Webrevs

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants