Skip to content

Commit

Permalink
Extend reflection configuration for VertX
Browse files Browse the repository at this point in the history
Doesn't seem to fix any functionality issues but prevents
`MissingRegistrationErrors` from being thrown when
`ThrowMissingRegistrationErrors` is enabled.

Related to quarkusio#41995
  • Loading branch information
zakkak committed Sep 4, 2024
1 parent 839d999 commit 12062b7
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
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.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveMethodBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.recording.RecorderContext;
import io.quarkus.gizmo.ClassOutput;
Expand Down Expand Up @@ -274,4 +276,20 @@ private Class<?> tryLoad(String name, ClassLoader tccl) {
throw new IllegalStateException("Unable to load type: " + name, e);
}
}

@BuildStep
void registerNativeImageResources(BuildProducer<NativeImageResourceBuildItem> resources) {
// Accessed by io.vertx.core.impl.VertxBuilder.<init>
resources.produce(new NativeImageResourceBuildItem("META-INF/services/io.vertx.core.spi.VertxServiceProvider"));
// Accessed by io.vertx.core.impl.VertxImpl.<init>
resources.produce(new NativeImageResourceBuildItem("META-INF/services/io.vertx.core.spi.VerticleFactory"));
}

@BuildStep
void registerReflectivelyAccessedMethods(BuildProducer<ReflectiveMethodBuildItem> reflectiveMethods) {
// Accessed by io.vertx.core.impl.VertxImpl.<init>
reflectiveMethods.produce(new ReflectiveMethodBuildItem("java.lang.Thread$Builder$OfVirtual", "name",
String.class, long.class));
reflectiveMethods.produce(new ReflectiveMethodBuildItem("java.lang.Thread$Builder", "factory", new Class[0]));
}
}

0 comments on commit 12062b7

Please sign in to comment.