Skip to content

Commit

Permalink
Merge pull request quarkusio#42941 from geoand/quarkusio#42919
Browse files Browse the repository at this point in the history
Register all resource classes for reflection when `ResourceInfo` is used
  • Loading branch information
geoand authored Sep 2, 2024
2 parents b702e31 + 7485b41 commit 152f093
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 152f093

Please sign in to comment.