Skip to content

Commit

Permalink
Review usage of BindingReflectionHintsRegistrar#registerReflectionHints
Browse files Browse the repository at this point in the history
Closes gh-32753
  • Loading branch information
snicoll committed May 2, 2024
1 parent 47c5cd2 commit abcc1df
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class BindingReflectionHintsRegistrar {
* @param hints the hints instance to use
* @param types the types to register
*/
public void registerReflectionHints(ReflectionHints hints, @Nullable Type... types) {
public void registerReflectionHints(ReflectionHints hints, Type... types) {
Set<Type> seen = new LinkedHashSet<>();
for (Type type : types) {
registerReflectionHints(hints, seen, type);
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -83,7 +83,10 @@ protected void registerParameterHints(ReflectionHints hints, Method method) {
for (Parameter parameter : method.getParameters()) {
MethodParameter methodParameter = MethodParameter.forParameter(parameter);
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)) {
this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType());
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -84,7 +84,10 @@ protected void registerParameterTypeHints(ReflectionHints hints, MethodParameter
this.bindingRegistrar.registerReflectionHints(hints, methodParameter.getGenericParameterType());
}
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);
}
}
}

Expand All @@ -94,7 +97,10 @@ protected void registerReturnTypeHints(ReflectionHints hints, MethodParameter re
this.bindingRegistrar.registerReflectionHints(hints, returnTypeParameter.getGenericParameterType());
}
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);
}
}
}

Expand Down

0 comments on commit abcc1df

Please sign in to comment.