diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java index 031abef44544b..a96468ab8b83a 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/ArtifactResultBuildItem.java @@ -16,9 +16,9 @@ public final class ArtifactResultBuildItem extends MultiBuildItem { private final Path path; private final String type; - private final Map metadata; + private final Map metadata; - public ArtifactResultBuildItem(Path path, String type, Map metadata) { + public ArtifactResultBuildItem(Path path, String type, Map metadata) { this.path = path; this.type = type; this.metadata = metadata; @@ -32,7 +32,7 @@ public String getType() { return type; } - public Map getMetadata() { + public Map getMetadata() { return metadata; } } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index 06dc22675293c..ad00129f0f466 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -176,7 +176,7 @@ OutputTargetBuildItem outputTarget(BuildSystemTargetBuildItem bst, PackageConfig ArtifactResultBuildItem jarOutput(JarBuildItem jarBuildItem) { if (jarBuildItem.getLibraryDir() != null) { return new ArtifactResultBuildItem(jarBuildItem.getPath(), PackageConfig.JAR, - Collections.singletonMap("library-dir", jarBuildItem.getLibraryDir())); + Collections.singletonMap("library-dir", jarBuildItem.getLibraryDir().toString())); } else { return new ArtifactResultBuildItem(jarBuildItem.getPath(), PackageConfig.JAR, Collections.emptyMap()); } 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 77ad5a2dc78eb..33027514c089d 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 @@ -10,11 +10,9 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; @@ -89,12 +87,8 @@ void nativeImageFeatures(BuildProducer features) { @BuildStep(onlyIf = NativeBuild.class) ArtifactResultBuildItem result(NativeImageBuildItem image) { NativeImageBuildItem.GraalVMVersion graalVMVersion = image.getGraalVMInfo(); - Map graalVMInfoProps = new HashMap<>(); - graalVMInfoProps.put("graalvm.version.full", graalVMVersion.getFullVersion()); - graalVMInfoProps.put("graalvm.version.version", graalVMVersion.getVersion()); - graalVMInfoProps.put("graalvm.version.javaVersion", "" + graalVMVersion.getJavaVersion()); - graalVMInfoProps.put("graalvm.version.distribution", graalVMVersion.getDistribution()); - return new ArtifactResultBuildItem(image.getPath(), PackageConfig.NATIVE, graalVMInfoProps); + return new ArtifactResultBuildItem(image.getPath(), PackageConfig.BuiltInType.NATIVE.getValue(), + graalVMVersion.toMap()); } @BuildStep(onlyIf = NativeSourcesBuild.class) diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java index ecba0b08bbfbe..d6df9bc896645 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java @@ -228,12 +228,10 @@ private void writeArtifactResultMetadataFile(BuildSystemTargetBuildItem outputTa if (lastResult.getPath() != null) { properties.put("path", outputTargetBuildItem.getOutputDirectory().relativize(lastResult.getPath()).toString()); } - Map metadata = lastResult.getMetadata(); + Map metadata = lastResult.getMetadata(); if (metadata != null) { - for (Map.Entry entry : metadata.entrySet()) { - if (entry.getValue() instanceof String) { - properties.put("metadata." + entry.getKey(), entry.getValue()); - } + for (Map.Entry entry : metadata.entrySet()) { + properties.put("metadata." + entry.getKey(), entry.getValue()); } } try (FileOutputStream fos = new FileOutputStream(quarkusArtifactMetadataPath.toFile())) { diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java index 640bc85b18df8..ba6aaf68ab579 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/ArtifactResult.java @@ -7,9 +7,9 @@ public class ArtifactResult { private final Path path; private final String type; - private final Map metadata; + private final Map metadata; - public ArtifactResult(Path path, String type, Map metadata) { + public ArtifactResult(Path path, String type, Map metadata) { this.path = path; this.type = type; this.metadata = metadata; @@ -23,7 +23,7 @@ public String getType() { return type; } - public Map getMetadata() { + public Map getMetadata() { return metadata; } } diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java index 53fb22ecfc1b7..ef72c927992f2 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/RegisterForReflectionITCase.java @@ -5,6 +5,9 @@ import org.junit.jupiter.api.Test; +import io.quarkus.test.junit.DisableIfBuiltWithGraalVMNewerThan; +import io.quarkus.test.junit.DisableIfBuiltWithGraalVMOlderThan; +import io.quarkus.test.junit.GraalVMVersion; import io.quarkus.test.junit.QuarkusIntegrationTest; import io.restassured.RestAssured; @@ -56,14 +59,21 @@ public void testTargetWithoutNested() { } @Test - public void testLambdaCapturing() { - final String resourceLambda = BASE_PKG + ".ResourceLambda"; - + @DisableIfBuiltWithGraalVMNewerThan(GraalVMVersion.GRAALVM_23_1_0) + public void testLambdaCapturingPre24_0() { // Starting with GraalVM 22.1 support Lambda functions serialization // (see https://github.com/oracle/graal/issues/3756) RestAssured.given().when().get("/reflection/lambda").then().body(startsWith("Comparator$$Lambda$")); } + @Test + @DisableIfBuiltWithGraalVMOlderThan(GraalVMVersion.GRAALVM_24_0_0) + public void testLambdaCapturingPost23_1() { + // Starting with GraalVM 24.0 lambda class names match the ones from HotSpot + // (see https://github.com/oracle/graal/pull/7775) + RestAssured.given().when().get("/reflection/lambda").then().body(startsWith("Comparator$$Lambda/")); + } + private void assertRegistration(String expected, String queryParam) { RestAssured.given().queryParam("className", queryParam).when().get(ENDPOINT).then().body(is(expected)); } diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java index 57a48a22a7209..4304ec31ff042 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMNewerThanCondition.java @@ -36,7 +36,7 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con Properties quarkusArtifactProperties = readQuarkusArtifactProperties(context); try { GraalVM.Version version = GraalVM.Version - .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.version").lines()); + .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.full").lines()); int comparison = annotationValue.getVersion().compareTo(version); if (comparison < 0) { return ConditionEvaluationResult.disabled("Native binary was built with GraalVM{version=" + version.toString() diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java index d7cf3db239844..44eda6c744d4a 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/DisableIfBuiltWithGraalVMOlderThanCondition.java @@ -36,7 +36,7 @@ public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext con Properties quarkusArtifactProperties = readQuarkusArtifactProperties(context); try { GraalVM.Version version = GraalVM.Version - .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.version").lines()); + .of(quarkusArtifactProperties.getProperty("metadata.graalvm.version.full").lines()); int comparison = annotationValue.getVersion().compareTo(version); if (comparison > 0) { return ConditionEvaluationResult.disabled("Native binary was built with GraalVM{version=" + version.toString() diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java index c157cfbdb0ff2..df95a13f166b9 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/GraalVMVersion.java @@ -3,7 +3,8 @@ import io.quarkus.deployment.pkg.steps.GraalVM; public enum GraalVMVersion { - GRAALVM_23_1_0(GraalVM.Version.VERSION_23_1_0); + GRAALVM_23_1_0(GraalVM.Version.VERSION_23_1_0), + GRAALVM_24_0_0(GraalVM.Version.VERSION_24_0_0); private final GraalVM.Version version;