Skip to content

Commit

Permalink
Merge pull request #32938 from geoand/#32886
Browse files Browse the repository at this point in the history
Register class for reflection when returning Multi for JAX-RS Resource
  • Loading branch information
geoand committed Apr 28, 2023
2 parents 7f65037 + 2779e93 commit 0b600c3
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static io.quarkus.resteasy.reactive.common.deployment.QuarkusResteasyReactiveDotNames.ROUTING_CONTEXT;
import static java.util.stream.Collectors.toList;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.DATE_FORMAT;
import static org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames.MULTI;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -436,9 +437,6 @@ public void setupEndpoints(ApplicationIndexBuildItem applicationIndexBuildItem,
paramConverterProviders.initializeDefaultFactories(factoryFunction);
paramConverterProviders.sort();

boolean filtersAccessResourceMethod = filtersAccessResourceMethod(
resourceInterceptorsBuildItem.getResourceInterceptors());

GeneratedClassGizmoAdaptor classOutput = new GeneratedClassGizmoAdaptor(generatedClassBuildItemBuildProducer, true);
try (ClassCreator c = new ClassCreator(classOutput,
QUARKUS_INIT_CLASS, null, Object.class.getName(), ResteasyReactiveInitialiser.class.getName());
Expand Down Expand Up @@ -529,6 +527,7 @@ public void accept(EndpointIndexer.ResourceMethodCallbackEntry entry) {
.source(source)
.build());

boolean paramsRequireReflection = false;
for (short i = 0; i < method.parametersCount(); i++) {
Type parameterType = method.parameterType(i);
if (!hasAnnotation(method, i, ResteasyReactiveServerDotNames.CONTEXT)) {
Expand All @@ -545,16 +544,16 @@ public void accept(EndpointIndexer.ResourceMethodCallbackEntry entry) {
.build());
}
if (parameterType.name().equals(FILE)) {
minimallyRegisterResourceClassForReflection(entry,
reflectiveClassBuildItemBuildProducer);
}
}
paramsRequireReflection = true;
break;

if (filtersAccessResourceMethod) {
minimallyRegisterResourceClassForReflection(entry, reflectiveClassBuildItemBuildProducer);
}
}

if (entry.additionalRegisterClassForReflectionCheck()) {
if (paramsRequireReflection ||
MULTI.toString().equals(entry.getResourceMethod().getSimpleReturnType()) ||
filtersAccessResourceMethod(resourceInterceptorsBuildItem.getResourceInterceptors()) ||
entry.additionalRegisterClassForReflectionCheck()) {
minimallyRegisterResourceClassForReflection(entry, reflectiveClassBuildItemBuildProducer);
}
}
Expand Down

0 comments on commit 0b600c3

Please sign in to comment.