From b530de426f3241b78633f7c0bcf27d27be0f58ca Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Wed, 24 Apr 2024 16:31:32 +0300 Subject: [PATCH] Move reinitialization of vertx classes out of NettyProcessor Vert.x is not a dependency of netty, meaning that the classes may not always be on the classpath. Fixes https://github.com/quarkusio/quarkus/issues/40243 Supersedes https://github.com/quarkusio/quarkus/pull/40248 --- .../netty/deployment/NettyProcessor.java | 8 +------- .../vertx/deployment/VertxProcessor.java | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java index 4c2741d2092ed..361033561c391 100644 --- a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java +++ b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java @@ -171,14 +171,8 @@ NativeImageConfigBuildItem build( if (QuarkusClassLoader.isClassPresentAtRuntime("io.netty.buffer.UnpooledByteBufAllocator")) { builder.addRuntimeReinitializedClass("io.netty.buffer.UnpooledByteBufAllocator") .addRuntimeReinitializedClass("io.netty.buffer.Unpooled") - .addRuntimeReinitializedClass("io.vertx.core.http.impl.Http1xServerResponse") .addRuntimeReinitializedClass("io.netty.handler.codec.http.HttpObjectAggregator") - .addRuntimeReinitializedClass("io.netty.handler.codec.ReplayingDecoderByteBuf") - .addRuntimeReinitializedClass("io.vertx.core.parsetools.impl.RecordParserImpl"); - - if (QuarkusClassLoader.isClassPresentAtRuntime("io.vertx.ext.web.client.impl.MultipartFormUpload")) { - builder.addRuntimeReinitializedClass("io.vertx.ext.web.client.impl.MultipartFormUpload"); - } + .addRuntimeReinitializedClass("io.netty.handler.codec.ReplayingDecoderByteBuf"); if (QuarkusClassLoader .isClassPresentAtRuntime("org.jboss.resteasy.reactive.client.impl.multipart.QuarkusMultipartFormUpload")) { diff --git a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java index 2d69d4a6d7be9..9bd62eba808f2 100644 --- a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java +++ b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java @@ -28,6 +28,7 @@ import io.quarkus.arc.processor.BeanInfo; import io.quarkus.arc.processor.BuildExtension; import io.quarkus.arc.processor.BuiltinScope; +import io.quarkus.bootstrap.classloading.QuarkusClassLoader; import io.quarkus.deployment.Capabilities; import io.quarkus.deployment.Capability; import io.quarkus.deployment.Feature; @@ -44,6 +45,7 @@ import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.ServiceStartBuildItem; import io.quarkus.deployment.builditem.ShutdownContextBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.gizmo.ClassOutput; @@ -196,6 +198,23 @@ void faultToleranceIntegration(Capabilities capabilities, BuildProducer tryLoad(String name, ClassLoader tccl) { try { return tccl.loadClass(name);