Skip to content

Commit b07d04f

Browse files
authored
GH-10083: Migrate spring-integration-camel to JSpecify Nullable
Related to: #10083 This change is applicable only to `spring-integration-camel`. *Replaced `org.springframework.lang.Nullable` with `org.jspecify.annotations.Nullable`. * Handled changes in `package-info.java` * Handled nullable related issues in `CamelMessageHandler`. Fixed issues in `CamelMessageHandler` as per review comments (suppressed warnings for `NullAway.Init` so that `Objects.requireNonNull` is not needed). Signed-off-by: Anayonkar Shivalkar <[email protected]>
1 parent ed544de commit b07d04f

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

spring-integration-camel/src/main/java/org/springframework/integration/camel/dsl/Camel.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2024 the original author or authors.
2+
* Copyright 2022-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,8 +19,7 @@
1919
import org.apache.camel.ExchangePattern;
2020
import org.apache.camel.ProducerTemplate;
2121
import org.apache.camel.builder.LambdaRouteBuilder;
22-
23-
import org.springframework.lang.Nullable;
22+
import org.jspecify.annotations.Nullable;
2423

2524
/**
2625
* Factory class for Apache Camel components DSL.

spring-integration-camel/src/main/java/org/springframework/integration/camel/dsl/CamelMessageHandlerSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 the original author or authors.
2+
* Copyright 2022-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,14 +23,14 @@
2323
import org.apache.camel.ExchangePattern;
2424
import org.apache.camel.ProducerTemplate;
2525
import org.apache.camel.builder.LambdaRouteBuilder;
26+
import org.jspecify.annotations.Nullable;
2627

2728
import org.springframework.expression.Expression;
2829
import org.springframework.integration.camel.outbound.CamelMessageHandler;
2930
import org.springframework.integration.camel.support.CamelHeaderMapper;
3031
import org.springframework.integration.dsl.MessageHandlerSpec;
3132
import org.springframework.integration.expression.FunctionExpression;
3233
import org.springframework.integration.mapping.HeaderMapper;
33-
import org.springframework.lang.Nullable;
3434
import org.springframework.messaging.Message;
3535
import org.springframework.util.Assert;
3636

spring-integration-camel/src/main/java/org/springframework/integration/camel/dsl/package-info.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
* Provides supporting classes for JavaDSL with Apache Camel components.
33
*/
44

5-
@org.springframework.lang.NonNullApi
6-
@org.springframework.lang.NonNullFields
5+
@org.jspecify.annotations.NullMarked
76
package org.springframework.integration.camel.dsl;

spring-integration-camel/src/main/java/org/springframework/integration/camel/outbound/CamelMessageHandler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 the original author or authors.
2+
* Copyright 2022-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@
2828
import org.apache.camel.builder.LambdaRouteBuilder;
2929
import org.apache.camel.builder.RouteBuilder;
3030
import org.apache.camel.model.RouteDefinition;
31+
import org.jspecify.annotations.Nullable;
3132

3233
import org.springframework.beans.factory.BeanFactory;
3334
import org.springframework.beans.factory.BeanInitializationException;
@@ -40,7 +41,6 @@
4041
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
4142
import org.springframework.integration.mapping.HeaderMapper;
4243
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
43-
import org.springframework.lang.Nullable;
4444
import org.springframework.messaging.Message;
4545
import org.springframework.util.Assert;
4646
import org.springframework.util.StringUtils;
@@ -68,6 +68,7 @@
6868
*/
6969
public class CamelMessageHandler extends AbstractReplyProducingMessageHandler {
7070

71+
@SuppressWarnings("NullAway.Init")
7172
private ProducerTemplate producerTemplate;
7273

7374
private Expression exchangePatternExpression = new ValueExpression<>(ExchangePattern.InOnly);
@@ -83,6 +84,7 @@ public class CamelMessageHandler extends AbstractReplyProducingMessageHandler {
8384
@Nullable
8485
private Expression exchangePropertiesExpression;
8586

87+
@SuppressWarnings("NullAway.Init")
8688
private StandardEvaluationContext evaluationContext;
8789

8890
public CamelMessageHandler() {
@@ -197,6 +199,7 @@ public void configure() throws Exception {
197199
}
198200

199201
@Override
202+
@Nullable
200203
protected Object handleRequestMessage(Message<?> requestMessage) {
201204
ExchangePattern exchangePattern =
202205
this.exchangePatternExpression.getValue(this.evaluationContext, requestMessage, ExchangePattern.class);

spring-integration-camel/src/main/java/org/springframework/integration/camel/outbound/package-info.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
* Provides classes for Apache Camel outbound channel adapters.
33
*/
44

5-
@org.springframework.lang.NonNullApi
6-
@org.springframework.lang.NonNullFields
5+
@org.jspecify.annotations.NullMarked
76
package org.springframework.integration.camel.outbound;

spring-integration-camel/src/main/java/org/springframework/integration/camel/support/package-info.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
* Provides supporting classes for Apache Camel channel adapters.
33
*/
44

5-
@org.springframework.lang.NonNullApi
6-
@org.springframework.lang.NonNullFields
5+
@org.jspecify.annotations.NullMarked
76
package org.springframework.integration.camel.support;

0 commit comments

Comments
 (0)