Skip to content

Commit

Permalink
Register all resource classes for reflection when ResourceInfo is used
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand authored and danielsoro committed Sep 20, 2024
1 parent 5f4d7d4 commit 54bc06f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.LEGACY_PUBLISHER;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.MULTI;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.PUBLISHER;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.RESOURCE_INFO;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.REST_MULTI;

import java.io.File;
Expand Down Expand Up @@ -127,6 +128,7 @@
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem;
import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.arc.deployment.BeanDiscoveryFinishedBuildItem;
import io.quarkus.arc.deployment.GeneratedBeanBuildItem;
import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.arc.runtime.BeanContainer;
Expand Down Expand Up @@ -1146,6 +1148,7 @@ public void additionalReflection(BeanArchiveIndexBuildItem beanArchiveIndexBuild
List<MessageBodyReaderBuildItem> messageBodyReaderBuildItems,
List<MessageBodyWriterBuildItem> messageBodyWriterBuildItems,
ResourceInterceptorsBuildItem resourceInterceptorsBuildItem,
BeanDiscoveryFinishedBuildItem beanDiscoveryFinishedBuildItem,
BuildProducer<ReflectiveClassBuildItem> producer) {
List<ResourceClass> resourceClasses = setupEndpointsResult.getResourceClasses();
IndexView index = beanArchiveIndexBuildItem.getIndex();
Expand Down Expand Up @@ -1197,7 +1200,10 @@ public void additionalReflection(BeanArchiveIndexBuildItem beanArchiveIndexBuild
serializersRequireResourceReflection = true;
}

if (serializersRequireResourceReflection) {
boolean resourceInfoUsed = beanDiscoveryFinishedBuildItem.getInjectionPoints().stream()
.anyMatch(i -> RESOURCE_INFO.equals(i.getRequiredType().name()));

if (serializersRequireResourceReflection || resourceInfoUsed) {
producer.produce(ReflectiveClassBuildItem
.builder(resourceClasses.stream().map(ResourceClass::getClassName).toArray(String[]::new))
.reason(getClass().getName())
Expand Down

0 comments on commit 54bc06f

Please sign in to comment.