Merge branch '6.1.x'

This commit is contained in:
Stéphane Nicoll 2024-05-02 17:02:08 +02:00
commit 305ebca56d
3 changed files with 15 additions and 7 deletions

View File

@ -63,8 +63,7 @@ public class BindingReflectionHintsRegistrar {
* @param hints the hints instance to use * @param hints the hints instance to use
* @param types the types to register * @param types the types to register
*/ */
@SuppressWarnings("NullAway") public void registerReflectionHints(ReflectionHints hints, Type... types) {
public void registerReflectionHints(ReflectionHints hints, @Nullable Type... types) {
Set<Type> seen = new HashSet<>(); Set<Type> seen = new HashSet<>();
for (Type type : types) { for (Type type : types) {
registerReflectionHints(hints, seen, type); registerReflectionHints(hints, seen, type);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -83,7 +83,10 @@ public class MessageMappingReflectiveProcessor implements ReflectiveProcessor {
for (Parameter parameter : method.getParameters()) { for (Parameter parameter : method.getParameters()) {
MethodParameter methodParameter = MethodParameter.forParameter(parameter); MethodParameter methodParameter = MethodParameter.forParameter(parameter);
if (Message.class.isAssignableFrom(methodParameter.getParameterType())) { if (Message.class.isAssignableFrom(methodParameter.getParameterType())) {
this.bindingRegistrar.registerReflectionHints(hints, getMessageType(methodParameter)); Type messageType = getMessageType(methodParameter);
if (messageType != null) {
this.bindingRegistrar.registerReflectionHints(hints, messageType);
}
} }
else if (couldBePayload(methodParameter)) { else if (couldBePayload(methodParameter)) {
this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType()); this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -84,7 +84,10 @@ class ControllerMappingReflectiveProcessor implements ReflectiveProcessor {
this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType()); this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType());
} }
else if (HttpEntity.class.isAssignableFrom(methodParameter.getParameterType())) { else if (HttpEntity.class.isAssignableFrom(methodParameter.getParameterType())) {
this.bindingRegistrar.registerReflectionHints(hints, getHttpEntityType(methodParameter)); Type httpEntityType = getHttpEntityType(methodParameter);
if (httpEntityType != null) {
this.bindingRegistrar.registerReflectionHints(hints, httpEntityType);
}
} }
} }
@ -94,7 +97,10 @@ class ControllerMappingReflectiveProcessor implements ReflectiveProcessor {
this.bindingRegistrar.registerReflectionHints(hints, returnTypeParameter.getGenericParameterType()); this.bindingRegistrar.registerReflectionHints(hints, returnTypeParameter.getGenericParameterType());
} }
else if (HttpEntity.class.isAssignableFrom(returnTypeParameter.getParameterType())) { else if (HttpEntity.class.isAssignableFrom(returnTypeParameter.getParameterType())) {
this.bindingRegistrar.registerReflectionHints(hints, getHttpEntityType(returnTypeParameter)); Type httpEntityType = getHttpEntityType(returnTypeParameter);
if (httpEntityType != null) {
this.bindingRegistrar.registerReflectionHints(hints, httpEntityType);
}
} }
} }