Update test-graal-native-image. - #2969
Conversation
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.
cpovirk
left a comment
There was a problem hiding this comment.
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!
|
(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.) |
|
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. |
|
I had mentioned it in #2957 (comment), but maybe you accidentally overlooked it. The proper fix has a pending open PR in graalvm/native-build-tools but this workaround here for Gson is also the official recommendation, see junit-team/junit-framework#5134 (comment). It appears that brittle hardcoded list of classes in graalvm/native-build-tools is also only needed for JDK <= 21, see junit-team/junit-framework#5134 (comment), which we still include in the test matrix though. In the past coordination between the junit-framework and native-build-tools maintainers worked fine, which is why we had not seen an issue like this before I think. It seems in this case this incompatibility was overlooked by accident before the JUnit release though, see junit-team/junit-framework#5134 (comment). But I must admit that I am not that familiar with the details of the native-maven-plugin. |
With the latest dependencies, this was failing with this message:
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.