Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-51416] Registering a class as initialize-at-build-time should immediately trigger initialization. #8193

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

graalvmbot
Copy link
Collaborator

The new "allow all hosted usage" class initialization policy behaved differently than the old one: when registering a class (not a package) with initializeAtBuildTime, then the class was not immediately initialized in the image generator. Initially, I thought that is a good idea because then unnecessary side effects of the class initializer are avoided. But the old behavior is better for many reasons:

  • We need a way to break class initialization deadlocks and cycles, and "initialize at build time" for a single class it the easiest way of doing that.
  • We want a deterministic behavior: when a class is initialized at build time, the side effects of the class initializer should be visible regardless whether the class is actually reachable in the application.

I plan to merge that also into the 24.0 release where the new strategy is the default for the first time.

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 22, 2024

@christianwimmer Are you planning to backport this to 24.0? We see this issue on JDK 22 based builds too. See for example:
graalvm#644 (comment) and
https://github.com/graalvm/mandrel/actions/runs/7591232948/job/20679453988#step:12:2252

@christianwimmer
Copy link
Member

Are you planning to backport this to 24.0?

Yes, it is right now in the merge queue for the 24.0 branch.

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 22, 2024

Thanks for the heads up!

@jerboaa
Copy link
Collaborator

jerboaa commented Jan 25, 2024

@zapster @christianwimmer Unfortunately this didn't seem to fix the issue we were seeing in Quarkus native integration tests. See #8075 (comment) FYI.

@zakkak
Copy link
Collaborator

zakkak commented Jan 26, 2024

FTR this was backported to 24.0 with b99a9f3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants