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 #41995
  • Loading branch information
zakkak committed Jul 30, 2024
1 parent a02d772 commit c9edbe6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ void processFaultToleranceAnnotations(SmallRyeFaultToleranceRecorder recorder,
if (ftMethod.isLegitimate()) {
ftMethods.add(ftMethod);

// io.smallrye.faulttolerance.internal.SecurityActions.findDeclaredMethodNames accesses class' methods
reflectiveClass
.produce(ReflectiveClassBuildItem.builder(beanClass.name().toString()).queryMethods().build());

if (annotationStore.hasAnnotation(method, DotNames.ASYNCHRONOUS)
&& annotationStore.hasAnnotation(method, DotNames.ASYNCHRONOUS_NON_BLOCKING)) {
exceptions.add(new DefinitionException(
Expand Down
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 c9edbe6

Please sign in to comment.