From ea67abe114042f9127734eee9cdfb9fd9e87ebb1 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Thu, 29 Sep 2022 19:42:41 +0300 Subject: [PATCH 1/3] Fix class cast exception with GraalVM 22.3 Fixes issues introduced in #28093 --- .../io/quarkus/deployment/steps/NativeImageFeatureStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java index d6589e21d8357..322bf30b8e761 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java @@ -185,7 +185,7 @@ public void write(String s, byte[] bytes) { TryBlock tryBlock = greaterThan22_2.tryBlock(); tryBlock.invokeStaticMethod(registerLambdaCapturingClass, - tryBlock.load(i.getClassName())); + tryBlock.loadClassFromTCCL(i.getClassName())); CatchBlockCreator catchBlock = tryBlock.addCatch(Throwable.class); catchBlock.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), From 1235d48d4dfe2d2ffd4f261f810cac7aa3e0d7a9 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Thu, 29 Sep 2022 19:45:38 +0300 Subject: [PATCH 2/3] Run Version comparison only once in dynamic proxy registration --- .../quarkus/deployment/steps/NativeImageFeatureStep.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java index 322bf30b8e761..7a4c59c54b82d 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java @@ -292,6 +292,10 @@ public void write(String s, byte[] bytes) { exports.produce(new JPMSExportBuildItem("org.graalvm.nativeimage.builder", "com.oracle.svm.core.jdk.proxy", GraalVM.Version.VERSION_22_1_0, GraalVM.Version.VERSION_22_3_0)); + ResultHandle versionCompareto22_3Result = overallCatch.invokeVirtualMethod(VERSION_COMPARE_TO, + overallCatch.invokeStaticMethod(VERSION_CURRENT), + overallCatch.marshalAsArray(int.class, overallCatch.load(22), overallCatch.load(3))); + for (NativeImageProxyDefinitionBuildItem proxy : proxies) { ResultHandle array = overallCatch.newArray(Class.class, overallCatch.load(proxy.getClasses().size())); int i = 0; @@ -302,10 +306,7 @@ public void write(String s, byte[] bytes) { } - BranchResult graalVm22_3Test = overallCatch - .ifGreaterEqualZero(overallCatch.invokeVirtualMethod(VERSION_COMPARE_TO, - overallCatch.invokeStaticMethod(VERSION_CURRENT), - overallCatch.marshalAsArray(int.class, overallCatch.load(22), overallCatch.load(3)))); + BranchResult graalVm22_3Test = overallCatch.ifGreaterEqualZero(versionCompareto22_3Result); /* GraalVM >= 22.3 */ try (BytecodeCreator greaterThan22_2 = graalVm22_3Test.trueBranch()) { MethodDescriptor registerMethod = ofMethod("org.graalvm.nativeimage.hosted.RuntimeProxyCreation", From 4beeaf3099647a78a3f0c93049939eaa044699d0 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Fri, 30 Sep 2022 11:58:34 +0300 Subject: [PATCH 3/3] Specify the module name when registering jaxp resource bundles --- .../main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/jaxp/deployment/src/main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java b/extensions/jaxp/deployment/src/main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java index 152b93015fef6..883b1e8ac0c3b 100644 --- a/extensions/jaxp/deployment/src/main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java +++ b/extensions/jaxp/deployment/src/main/java/io/quarkus/jaxp/deployment/JaxpProcessor.java @@ -1,5 +1,6 @@ package io.quarkus.jaxp.deployment; +import java.util.function.Consumer; import java.util.stream.Stream; import io.quarkus.deployment.annotations.BuildProducer; @@ -30,6 +31,8 @@ void reflectiveClasses(BuildProducer reflectiveClass) @BuildStep void resourceBundles(BuildProducer resourceBundle) { + Consumer resourceBundleItemProducer = bundleName -> resourceBundle + .produce(new NativeImageResourceBundleBuildItem(bundleName, "java.xml")); Stream.of( "com.sun.org.apache.xml.internal.serializer.utils.SerializerMessages", "com.sun.org.apache.xml.internal.res.XMLErrorResources", @@ -37,8 +40,7 @@ void resourceBundles(BuildProducer resourceB "com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", "com.sun.org.apache.xerces.internal.impl.xpath.regex.message") - .map(NativeImageResourceBundleBuildItem::new) - .forEach(resourceBundle::produce); + .forEach(resourceBundleItemProducer); } @BuildStep