Skip to content

Commit 2d256c2

Browse files
committed
Add nullability annotations to module/spring-boot-activemq
See gh-46587
1 parent bac4a38 commit 2d256c2

12 files changed

+55
-31
lines changed

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQAutoConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import jakarta.jms.ConnectionFactory;
2020
import org.apache.activemq.ActiveMQConnectionFactory;
21+
import org.jspecify.annotations.Nullable;
2122

2223
import org.springframework.boot.autoconfigure.AutoConfiguration;
2324
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -71,12 +72,12 @@ public String getBrokerUrl() {
7172
}
7273

7374
@Override
74-
public String getUser() {
75+
public @Nullable String getUser() {
7576
return this.properties.getUser();
7677
}
7778

7879
@Override
79-
public String getPassword() {
80+
public @Nullable String getPassword() {
8081
return this.properties.getPassword();
8182
}
8283

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQConnectionDetails.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.activemq.autoconfigure;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
2022

2123
/**
@@ -37,12 +39,12 @@ public interface ActiveMQConnectionDetails extends ConnectionDetails {
3739
* Login user to authenticate to the broker.
3840
* @return the login user to authenticate to the broker or {@code null}
3941
*/
40-
String getUser();
42+
@Nullable String getUser();
4143

4244
/**
4345
* Login to authenticate against the broker.
4446
* @return the login to authenticate against the broker or {@code null}
4547
*/
46-
String getPassword();
48+
@Nullable String getPassword();
4749

4850
}

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQConnectionFactoryConfigurer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.List;
2121

2222
import org.apache.activemq.ActiveMQConnectionFactory;
23+
import org.jspecify.annotations.Nullable;
2324

2425
import org.springframework.boot.activemq.autoconfigure.ActiveMQProperties.Packages;
2526
import org.springframework.util.Assert;
@@ -40,7 +41,7 @@ class ActiveMQConnectionFactoryConfigurer {
4041
private final List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers;
4142

4243
ActiveMQConnectionFactoryConfigurer(ActiveMQProperties properties,
43-
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
44+
@Nullable List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
4445
Assert.notNull(properties, "'properties' must not be null");
4546
this.properties = properties;
4647
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers : Collections.emptyList();

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/ActiveMQProperties.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.util.ArrayList;
2121
import java.util.List;
2222

23+
import org.jspecify.annotations.Nullable;
24+
2325
import org.springframework.boot.context.properties.ConfigurationProperties;
2426
import org.springframework.boot.context.properties.NestedConfigurationProperty;
2527
import org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties;
@@ -44,17 +46,17 @@ public class ActiveMQProperties {
4446
/**
4547
* URL of the ActiveMQ broker. Auto-generated by default.
4648
*/
47-
private String brokerUrl;
49+
private @Nullable String brokerUrl;
4850

4951
/**
5052
* Login user of the broker.
5153
*/
52-
private String user;
54+
private @Nullable String user;
5355

5456
/**
5557
* Login password of the broker.
5658
*/
57-
private String password;
59+
private @Nullable String password;
5860

5961
private final Embedded embedded = new Embedded();
6062

@@ -79,27 +81,27 @@ public class ActiveMQProperties {
7981

8082
private final Packages packages = new Packages();
8183

82-
public String getBrokerUrl() {
84+
public @Nullable String getBrokerUrl() {
8385
return this.brokerUrl;
8486
}
8587

86-
public void setBrokerUrl(String brokerUrl) {
88+
public void setBrokerUrl(@Nullable String brokerUrl) {
8789
this.brokerUrl = brokerUrl;
8890
}
8991

90-
public String getUser() {
92+
public @Nullable String getUser() {
9193
return this.user;
9294
}
9395

94-
public void setUser(String user) {
96+
public void setUser(@Nullable String user) {
9597
this.user = user;
9698
}
9799

98-
public String getPassword() {
100+
public @Nullable String getPassword() {
99101
return this.password;
100102
}
101103

102-
public void setPassword(String password) {
104+
public void setPassword(@Nullable String password) {
103105
this.password = password;
104106
}
105107

@@ -174,18 +176,18 @@ public static class Packages {
174176
/**
175177
* Whether to trust all packages.
176178
*/
177-
private Boolean trustAll;
179+
private @Nullable Boolean trustAll;
178180

179181
/**
180182
* List of specific packages to trust (when not trusting all packages).
181183
*/
182184
private List<String> trusted = new ArrayList<>();
183185

184-
public Boolean getTrustAll() {
186+
public @Nullable Boolean getTrustAll() {
185187
return this.trustAll;
186188
}
187189

188-
public void setTrustAll(Boolean trustAll) {
190+
public void setTrustAll(@Nullable Boolean trustAll) {
189191
this.trustAll = trustAll;
190192
}
191193

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/autoconfigure/package-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
/**
1818
* Auto-configuration for ActiveMQ.
1919
*/
20+
@NullMarked
2021
package org.springframework.boot.activemq.autoconfigure;
22+
23+
import org.jspecify.annotations.NullMarked;

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQClassicDockerComposeConnectionDetailsFactory.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.activemq.docker.compose;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.boot.activemq.autoconfigure.ActiveMQConnectionDetails;
2022
import org.springframework.boot.docker.compose.core.RunningService;
2123
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
@@ -65,12 +67,12 @@ public String getBrokerUrl() {
6567
}
6668

6769
@Override
68-
public String getUser() {
70+
public @Nullable String getUser() {
6971
return this.environment.getUser();
7072
}
7173

7274
@Override
73-
public String getPassword() {
75+
public @Nullable String getPassword() {
7476
return this.environment.getPassword();
7577
}
7678

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQClassicEnvironment.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.util.Map;
2020

21+
import org.jspecify.annotations.Nullable;
22+
2123
/**
2224
* ActiveMQ environment details.
2325
*
@@ -26,20 +28,20 @@
2628
*/
2729
class ActiveMQClassicEnvironment {
2830

29-
private final String user;
31+
private final @Nullable String user;
3032

31-
private final String password;
33+
private final @Nullable String password;
3234

3335
ActiveMQClassicEnvironment(Map<String, String> env) {
3436
this.user = env.get("ACTIVEMQ_CONNECTION_USER");
3537
this.password = env.get("ACTIVEMQ_CONNECTION_PASSWORD");
3638
}
3739

38-
String getUser() {
40+
@Nullable String getUser() {
3941
return this.user;
4042
}
4143

42-
String getPassword() {
44+
@Nullable String getPassword() {
4345
return this.password;
4446
}
4547

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQDockerComposeConnectionDetailsFactory.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package org.springframework.boot.activemq.docker.compose;
1818

19+
import org.jspecify.annotations.Nullable;
20+
1921
import org.springframework.boot.activemq.autoconfigure.ActiveMQConnectionDetails;
2022
import org.springframework.boot.docker.compose.core.RunningService;
2123
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
@@ -64,12 +66,12 @@ public String getBrokerUrl() {
6466
}
6567

6668
@Override
67-
public String getUser() {
69+
public @Nullable String getUser() {
6870
return this.environment.getUser();
6971
}
7072

7173
@Override
72-
public String getPassword() {
74+
public @Nullable String getPassword() {
7375
return this.environment.getPassword();
7476
}
7577

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/ActiveMQEnvironment.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,29 @@
1818

1919
import java.util.Map;
2020

21+
import org.jspecify.annotations.Nullable;
22+
2123
/**
2224
* ActiveMQ environment details.
2325
*
2426
* @author Stephane Nicoll
2527
*/
2628
class ActiveMQEnvironment {
2729

28-
private final String user;
30+
private final @Nullable String user;
2931

30-
private final String password;
32+
private final @Nullable String password;
3133

3234
ActiveMQEnvironment(Map<String, String> env) {
3335
this.user = env.get("ACTIVEMQ_USERNAME");
3436
this.password = env.get("ACTIVEMQ_PASSWORD");
3537
}
3638

37-
String getUser() {
39+
@Nullable String getUser() {
3840
return this.user;
3941
}
4042

41-
String getPassword() {
43+
@Nullable String getPassword() {
4244
return this.password;
4345
}
4446

module/spring-boot-activemq/src/main/java/org/springframework/boot/activemq/docker/compose/package-info.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
/**
1818
* Support for Docker Compose ActiveMQ service connections.
1919
*/
20+
@NullMarked
2021
package org.springframework.boot.activemq.docker.compose;
22+
23+
import org.jspecify.annotations.NullMarked;

0 commit comments

Comments
 (0)