-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-10083: Migrate spring-integration-ws
module to Jspecify
#10098
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
base: main
Are you sure you want to change the base?
Conversation
…pecify Related to: spring-projects#10083 - Replace `org.springframework.lang.Nullable` with `org.jspecify.annotations.Nullable` - Migrate `package-info.java` files to use `@NullMarked` annotation - Add `@SuppressWarnings("NullAway.Init")` for fields initialized in lifecycle methods Signed-off-by: Jooyoung Pyoung <[email protected]>
I found some packages don't have |
...ation-ws/src/main/java/org/springframework/integration/ws/dsl/BaseWsOutboundGatewaySpec.java
Outdated
Show resolved
Hide resolved
...ation-ws/src/main/java/org/springframework/integration/ws/dsl/BaseWsOutboundGatewaySpec.java
Outdated
Show resolved
Hide resolved
...s/src/main/java/org/springframework/integration/ws/dsl/MarshallingWsOutboundGatewaySpec.java
Outdated
Show resolved
Hide resolved
Right. Let's finish with the current change you have so far and then we will go from there for others. Thanks |
- Use proper array nullability: `WebServiceMessageSender @nullable []` - Fix inner class annotation placement: `DefaultUriBuilderFactory.@nullable EncodingMode` - Set default Jaxb2Marshaller for gatewayMarshaller field Signed-off-by: Jooyoung Pyoung <[email protected]>
I've applied all the requested changes!
I'll add commits tomorrow for other packages in the |
I know, but the easier way to proceed is to replace imports and leave as is. It is fine to continue in this PR. Thanks. |
...s/src/main/java/org/springframework/integration/ws/dsl/MarshallingWsOutboundGatewaySpec.java
Outdated
Show resolved
Hide resolved
* Add `@NullMarked` to all the `ws` packages * Add `@Nullable` or `@SuppressWarnings("NullAway.Init")` whenever it is requested * Add defensive null checks for better safety (`DefaultSoapHeaderMapper`, `SimpleWebServiceOutboundGateway`) Signed-off-by: Jooyoung Pyoung <[email protected]>
@@ -84,15 +87,17 @@ public abstract class AbstractWebServiceOutboundGateway extends AbstractReplyPro | |||
|
|||
private boolean webServiceTemplateExplicitlySet; | |||
|
|||
public AbstractWebServiceOutboundGateway(final String uri, WebServiceMessageFactory messageFactory) { | |||
@SuppressWarnings("NullAway") | |||
public AbstractWebServiceOutboundGateway(final String uri, @Nullable WebServiceMessageFactory messageFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct.
The WebServiceTemplate
expects from us a WebServiceMessageFactory
as a not null.
If you see somewhere it is, let's mitigate it over there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then.. when ctors pass null for WebServiceMessageFactory
, I'll replace null with SaajSoapMessageFactory
as the default. Does this sound good?
Based on the WebServiceTemplate.properties, SaajSoapMessageFactory
is indeed the default strategy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we allow to pass null at all?
The WebServiceTemplate
does not expect that from us, so let's comeback to not-null for this ctors!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I meant that I'll remove @Nullable
from the constructor parameters and fix the calling sites to pass SaajSoapMessageFactory
instance instead of null.
For example:
// Instead of
super(uri, null);
// I'll change to
super(uri, new SaajSoapMessageFactory());
Am I still misunderstanding something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see:
public MarshallingWebServiceOutboundGateway(DestinationProvider destinationProvider,
WebServiceTemplate webServiceTemplate) {
super(destinationProvider, null);
doSetWebServiceTemplate(webServiceTemplate);
}
I think it is better to introduce a protected
ctor in the AbstractWebServiceOutboundGateway
based on the WebServiceTemplate
then.
@@ -68,7 +69,7 @@ public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, | |||
|
|||
public SimpleWebServiceOutboundGateway(DestinationProvider destinationProvider, | |||
@Nullable SourceExtractor<?> sourceExtractor, | |||
WebServiceMessageFactory messageFactory) { | |||
@Nullable WebServiceMessageFactory messageFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to fix those places to not provide a null for the WebServiceMessageFactory
.
super(destinationProvider, messageFactory); | ||
configureMarshallers(marshaller, unmarshaller); | ||
} | ||
|
||
@SuppressWarnings("NullAway") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very OK with these @SuppressWarnings("NullAway")
, but we can look into that separately if that is too much for this change cycle.
Related to: #10083
org.springframework.lang.Nullable
withorg.jspecify.annotations.Nullable
package-info.java
files to use@NullMarked
annotation@SuppressWarnings("NullAway.Init")
for fields initialized in lifecycle methodsFor the array fields
BaseWsOutboundGatewaySpec.messageSenders
andBaseWsOutboundGatewaySpec.gatewayInterceptors
, I applied@SuppressWarnings("NullAway.Init")
instead of@Nullable
because adding@Nullable
still produces the same NullAway warnings.