Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register class for reflection when returning Multi for JAX-RS Resource #32938

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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