Browse Source

Add nullability annotations to module/spring-boot-artemis

See gh-46587
pull/46599/head
Moritz Halbritter 6 months ago
parent
commit
23b902f3bb
  1. 9
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisAutoConfiguration.java
  2. 10
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisConnectionDetails.java
  3. 3
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisNoOpBindingRegistry.java
  4. 31
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisProperties.java
  5. 3
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/package-info.java
  6. 6
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/docker/compose/ArtemisDockerComposeConnectionDetailsFactory.java
  7. 10
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/docker/compose/ArtemisEnvironment.java
  8. 3
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/docker/compose/package-info.java
  9. 5
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/testcontainers/ArtemisContainerConnectionDetailsFactory.java
  10. 3
      module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/testcontainers/package-info.java

9
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisAutoConfiguration.java

@ -18,6 +18,7 @@ package org.springframework.boot.artemis.autoconfigure; @@ -18,6 +18,7 @@ package org.springframework.boot.artemis.autoconfigure;
import jakarta.jms.ConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -69,22 +70,22 @@ public final class ArtemisAutoConfiguration { @@ -69,22 +70,22 @@ public final class ArtemisAutoConfiguration {
}
@Override
public ArtemisMode getMode() {
public @Nullable ArtemisMode getMode() {
return this.properties.getMode();
}
@Override
public String getBrokerUrl() {
public @Nullable String getBrokerUrl() {
return this.properties.getBrokerUrl();
}
@Override
public String getUser() {
public @Nullable String getUser() {
return this.properties.getUser();
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return this.properties.getPassword();
}

10
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisConnectionDetails.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.boot.artemis.autoconfigure;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
/**
@ -30,24 +32,24 @@ public interface ArtemisConnectionDetails extends ConnectionDetails { @@ -30,24 +32,24 @@ public interface ArtemisConnectionDetails extends ConnectionDetails {
* Artemis deployment mode, auto-detected by default.
* @return the Artemis deployment mode, auto-detected by default
*/
ArtemisMode getMode();
@Nullable ArtemisMode getMode();
/**
* Artemis broker url.
* @return the Artemis broker url
*/
String getBrokerUrl();
@Nullable String getBrokerUrl();
/**
* Login user of the broker.
* @return the login user of the broker
*/
String getUser();
@Nullable String getUser();
/**
* Login password of the broker.
* @return the login password of the broker
*/
String getPassword();
@Nullable String getPassword();
}

3
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisNoOpBindingRegistry.java

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
package org.springframework.boot.artemis.autoconfigure;
import org.apache.activemq.artemis.spi.core.naming.BindingRegistry;
import org.jspecify.annotations.Nullable;
/**
* A no-op implementation of the {@link BindingRegistry}.
@ -28,7 +29,7 @@ import org.apache.activemq.artemis.spi.core.naming.BindingRegistry; @@ -28,7 +29,7 @@ import org.apache.activemq.artemis.spi.core.naming.BindingRegistry;
public class ArtemisNoOpBindingRegistry implements BindingRegistry {
@Override
public Object lookup(String s) {
public @Nullable Object lookup(String s) {
return null;
}

31
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/autoconfigure/ArtemisProperties.java

@ -22,6 +22,7 @@ import java.util.UUID; @@ -22,6 +22,7 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
@ -41,57 +42,57 @@ public class ArtemisProperties { @@ -41,57 +42,57 @@ public class ArtemisProperties {
/**
* Artemis deployment mode, auto-detected by default.
*/
private ArtemisMode mode;
private @Nullable ArtemisMode mode;
/**
* Artemis broker url.
*/
private String brokerUrl;
private @Nullable String brokerUrl;
/**
* Login user of the broker.
*/
private String user;
private @Nullable String user;
/**
* Login password of the broker.
*/
private String password;
private @Nullable String password;
private final Embedded embedded = new Embedded();
@NestedConfigurationProperty
private final JmsPoolConnectionFactoryProperties pool = new JmsPoolConnectionFactoryProperties();
public ArtemisMode getMode() {
public @Nullable ArtemisMode getMode() {
return this.mode;
}
public void setMode(ArtemisMode mode) {
public void setMode(@Nullable ArtemisMode mode) {
this.mode = mode;
}
public String getBrokerUrl() {
public @Nullable String getBrokerUrl() {
return this.brokerUrl;
}
public void setBrokerUrl(String brokerUrl) {
public void setBrokerUrl(@Nullable String brokerUrl) {
this.brokerUrl = brokerUrl;
}
public String getUser() {
public @Nullable String getUser() {
return this.user;
}
public void setUser(String user) {
public void setUser(@Nullable String user) {
this.user = user;
}
public String getPassword() {
public @Nullable String getPassword() {
return this.password;
}
public void setPassword(String password) {
public void setPassword(@Nullable String password) {
this.password = password;
}
@ -128,7 +129,7 @@ public class ArtemisProperties { @@ -128,7 +129,7 @@ public class ArtemisProperties {
/**
* Journal file directory. Not necessary if persistence is turned off.
*/
private String dataDirectory;
private @Nullable String dataDirectory;
/**
* List of queues to create on startup.
@ -171,11 +172,11 @@ public class ArtemisProperties { @@ -171,11 +172,11 @@ public class ArtemisProperties {
this.persistent = persistent;
}
public String getDataDirectory() {
public @Nullable String getDataDirectory() {
return this.dataDirectory;
}
public void setDataDirectory(String dataDirectory) {
public void setDataDirectory(@Nullable String dataDirectory) {
this.dataDirectory = dataDirectory;
}

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

@ -19,4 +19,7 @@ @@ -19,4 +19,7 @@
*
* @author Eddú Meléndez
*/
@NullMarked
package org.springframework.boot.artemis.autoconfigure;
import org.jspecify.annotations.NullMarked;

6
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/docker/compose/ArtemisDockerComposeConnectionDetailsFactory.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.boot.artemis.docker.compose;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.artemis.autoconfigure.ArtemisConnectionDetails;
import org.springframework.boot.artemis.autoconfigure.ArtemisMode;
import org.springframework.boot.docker.compose.core.RunningService;
@ -71,12 +73,12 @@ class ArtemisDockerComposeConnectionDetailsFactory @@ -71,12 +73,12 @@ class ArtemisDockerComposeConnectionDetailsFactory
}
@Override
public String getUser() {
public @Nullable String getUser() {
return this.environment.getUser();
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return this.environment.getPassword();
}

10
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/docker/compose/ArtemisEnvironment.java

@ -18,6 +18,8 @@ package org.springframework.boot.artemis.docker.compose; @@ -18,6 +18,8 @@ package org.springframework.boot.artemis.docker.compose;
import java.util.Map;
import org.jspecify.annotations.Nullable;
/**
* Artemis environment details.
*
@ -26,20 +28,20 @@ import java.util.Map; @@ -26,20 +28,20 @@ import java.util.Map;
*/
class ArtemisEnvironment {
private final String user;
private final @Nullable String user;
private final String password;
private final @Nullable String password;
ArtemisEnvironment(Map<String, String> env) {
this.user = env.get("ARTEMIS_USER");
this.password = env.get("ARTEMIS_PASSWORD");
}
String getUser() {
@Nullable String getUser() {
return this.user;
}
String getPassword() {
@Nullable String getPassword() {
return this.password;
}

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

@ -17,4 +17,7 @@ @@ -17,4 +17,7 @@
/**
* Support for Docker Compose Artemis service connections.
*/
@NullMarked
package org.springframework.boot.artemis.docker.compose;
import org.jspecify.annotations.NullMarked;

5
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/testcontainers/ArtemisContainerConnectionDetailsFactory.java

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
package org.springframework.boot.artemis.testcontainers;
import org.jspecify.annotations.Nullable;
import org.testcontainers.activemq.ArtemisContainer;
import org.springframework.boot.artemis.autoconfigure.ArtemisConnectionDetails;
@ -57,12 +58,12 @@ class ArtemisContainerConnectionDetailsFactory @@ -57,12 +58,12 @@ class ArtemisContainerConnectionDetailsFactory
}
@Override
public String getUser() {
public @Nullable String getUser() {
return getContainer().getUser();
}
@Override
public String getPassword() {
public @Nullable String getPassword() {
return getContainer().getPassword();
}

3
module/spring-boot-artemis/src/main/java/org/springframework/boot/artemis/testcontainers/package-info.java

@ -17,4 +17,7 @@ @@ -17,4 +17,7 @@
/**
* Support for testcontainers Artemis service connections.
*/
@NullMarked
package org.springframework.boot.artemis.testcontainers;
import org.jspecify.annotations.NullMarked;

Loading…
Cancel
Save