From 42d7a135a7f072e67fc77481e5d88e693b1e7814 Mon Sep 17 00:00:00 2001 From: Michal Karm Babacek Date: Fri, 25 Oct 2024 01:18:30 +0200 Subject: [PATCH] [native-image] Adds -H:+ForeignAPISupport for all GraalVM 24.2+ --- .../deployment/pkg/steps/NativeImageBuildStep.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 29a287fac687f..fb8daf5b727cf 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -834,6 +834,16 @@ public NativeImageInvokerInfo build() { addExperimentalVMOption(nativeImageArgs, "-H:+AllowFoldMethods"); + /* + * Foreign Function and Memory API in Native Image, JDK's JEP 454 + * This is needed for JDK 24+ internal native calls due to AWT, + * e.g. JDK-8337237 et al. + * + */ + if (graalVMVersion.compareTo(GraalVM.Version.VERSION_24_2_0) >= 0) { + addExperimentalVMOption(nativeImageArgs, "-H:+ForeignAPISupport"); + } + if (nativeConfig.headless()) { nativeImageArgs.add("-J-Djava.awt.headless=true"); }