native-build-tools icon indicating copy to clipboard operation
native-build-tools copied to clipboard

JUnit class initialization error

Open sdeleuze opened this issue 9 months ago • 0 comments

When building the Spring data-jdbc-h2-kotlin AOT smoke test (sources available here), we observe the following error:

Error: An object of type 'org.junit.platform.launcher.core.SessionPerRequestLauncher' was found in the image heap. This type, however, is marked for initialization at image run time for the following reason: classes are initialized at run time by default.

This class is configured to be initialized at build time here but recent version of GraalVM were expected to solve this kind of issue by reinitializing classes at runtime as far as I understand, so I am not sure why we see that blocking error. I am using 22.0.1-graalce from SDKman.

To reproduce:

sdk install java 22.0.1-graalce
git clone https://github.com/spring-projects/spring-aot-smoke-tests.git
sdk env install
sdk env
GRAALVM_HOME=/ADAPT-TO-YOUR-LOCAL-ENV/.sdkman/candidates/java/22.0.1-graalce ./gradlew :data:data-jdbc-h2-kotlin:nativeTestCompile

Fail as well with 23.ea.9-graal from SDKman.

sdeleuze avatar May 23 '24 12:05 sdeleuze