Skip to content

Conversation

@eamonnmcmanus
Copy link
Member

With the latest dependencies, this was failing with this message:

Error: Classes that should be initialized at run time got initialized during image building:
 org.junit.jupiter.engine.discovery.MethodSegmentResolver was unintentionally initialized at build time.

I don't know enough about GraalVM to be sure of what the best fix is, but Gemini suggested the thing I'm doing here. It seems to work.

With the latest dependencies, this was failing with this message:
```
Error: Classes that should be initialized at run time got initialized during image building:
 org.junit.jupiter.engine.discovery.MethodSegmentResolver was unintentionally initialized at build time.
```

I don't know enough about GraalVM to be sure of what the best fix is,
but Gemini suggested the thing I'm doing here. It seems to work.
Copy link
Member

@cpovirk cpovirk left a comment

Choose a reason for hiding this comment

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

I was curious enough to determine that various JUnit files, such as ~/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.12.1/junit-jupiter-engine-5.12.1.jar, have META-INF/native-image/org.junit.jupiter/junit-jupiter-engine/native-image.properties files that include a bunch of --initialize-at-build-time values. It's plausible that something here should actually be fixed on the JUnit side, or it's possible that Maven is mixing up our dependency versions somehow despite the BOM.

I did dig up this, which sure looks related: junit-team/junit-framework@09d1788

But the lazy way to interpret that is that JUnit already knows what to do and that we're just following along, so let's go with that!

@cpovirk
Copy link
Member

cpovirk commented Dec 25, 2025

(I see the comment reference to graalvm/native-build-tools#706, which seems to be about duplicate classes, so maybe we're just getting an old GraalVM copy of a class and a new JUnit-proper copy or similar.)

@eamonnmcmanus
Copy link
Member Author

It looks like @Marcono1234 may have a better handle on what's going on here, and may be able to propose a better fix. I'll go with this one for now since it does allow us to update the dependencies.

@eamonnmcmanus eamonnmcmanus merged commit bf5d3d6 into google:main Dec 25, 2025
16 checks passed
@eamonnmcmanus eamonnmcmanus deleted the graal branch December 25, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants