Skip to content

Conversation

cppwfs
Copy link
Contributor

@cppwfs cppwfs commented Sep 4, 2025

Related to: #10083

  • AbstractHeaderMapper.java - Enhanced null safety by adding @nullable annotations to fields and methods.
  • Updated method signatures to match those in AbstractHeaderMapper for the following classes:
    • DefaultAmqpHeaderMapper.java
    • DefaultSoapHeaderMapper.java
    • DefaultXmppHeaderMapper.java

@cppwfs cppwfs requested a review from artembilan September 4, 2025 13:29
Related to: spring-projects#10083
* AbstractHeaderMapper.java - Enhanced null safety by adding @nullable annotations to fields and methods.
* Updated method signatures to match those in AbstractHeaderMapper for the following classes:
   - DefaultAmqpHeaderMapper.java
   - DefaultSoapHeaderMapper.java
   - DefaultXmppHeaderMapper.java
@cppwfs cppwfs force-pushed the GH-10083-core-mapping branch from f349850 to 14a2d7c Compare September 4, 2025 13:30
Add Contract for buildResolvableType where the first param can be anything, and if the 2 or 3 value is not null, it will return a not null.
* @since 5.2.4
*/
public static ResolvableType buildResolvableType(@Nullable Class<?> targetClass, @Nullable Class<?> contentClass,
@Contract("_, !null, _ -> !null; _, _, !null -> !null")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong.
The method does not return null at all.
See getClassForValue().
That's where the @Contract has to be.

Class<?> keyClass = getClassForValue(classLoader, keyClassValue);
Class<?> contentClass = getClassForValue(classLoader, contentClassValue);

Assert.notNull(targetClass, "targetClass must not be null");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you fix getClassForValue() with the @Contract, this is not necessary.

return buildResolvableType(targetClass, contentClass, keyClass);
}

@Nullable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, move this next to the return type.

Remove associated Assert.state.
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT.
Will merge when build is green.

@artembilan artembilan merged commit b5cf9b3 into spring-projects:main Sep 4, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants