Skip to content

Commit

Permalink
Merge pull request #28316 from zakkak/2022-09-29-fix-main
Browse files Browse the repository at this point in the history
Fixes related to using public APIs introduced in GraalVM 22.3
  • Loading branch information
gsmet authored Sep 30, 2022
2 parents 4b144c6 + 4beeaf3 commit 38f4138
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -30,15 +31,16 @@ void reflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClass)

@BuildStep
void resourceBundles(BuildProducer<NativeImageResourceBundleBuildItem> resourceBundle) {
Consumer<String> 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",
"com.sun.org.apache.xerces.internal.impl.msg.SAXMessages",
"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
Expand Down

0 comments on commit 38f4138

Please sign in to comment.