SLING-7798 Switch from JSR-305 annotations to JetBrains Nullable/NotNull annotations
diff --git a/pom.xml b/pom.xml
index 0c14655..5566834 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,9 +135,10 @@
</reporting>
<dependencies>
<dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>jsr305</artifactId>
- <version>2.0.1</version>
+ <groupId>org.jetbrains</groupId>
+ <artifactId>annotations</artifactId>
+ <version>16.0.2</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
diff --git a/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java b/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java
index 7cb50ca..52450d8 100644
--- a/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java
+++ b/src/main/java/org/apache/sling/jms/impl/JMSQueueManager.java
@@ -25,7 +25,6 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -43,6 +42,7 @@
import org.apache.sling.mom.QueueReader;
import org.apache.sling.mom.RequeueMessageException;
import org.apache.sling.mom.Types;
+import org.jetbrains.annotations.NotNull;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
@@ -101,7 +101,7 @@
* @param message the message to post to the queue.
*/
@Override
- public void add(@Nonnull Types.QueueName name, @Nonnull Map<String, Object> message) {
+ public void add(@NotNull Types.QueueName name, @NotNull Map<String, Object> message) {
Session session = null;
try {
session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
diff --git a/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java b/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java
index 967a92f..423a164 100644
--- a/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java
+++ b/src/main/java/org/apache/sling/jms/impl/JMSTopicManager.java
@@ -27,7 +27,6 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
import javax.jms.Connection;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -43,6 +42,7 @@
import org.apache.sling.mom.Subscriber;
import org.apache.sling.mom.TopicManager;
import org.apache.sling.mom.Types;
+import org.jetbrains.annotations.NotNull;
import org.osgi.framework.ServiceReference;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
@@ -205,10 +205,10 @@
private final MessageFilter filter;
private final List<MessageConsumer> consumers = new ArrayList<MessageConsumer>();
- public FilteredTopicSubscriber(@Nonnull Session session,
- @Nonnull Subscriber subscriber,
- @Nonnull String[] topicNames,
- @Nonnull MessageFilter filter) throws JMSException {
+ public FilteredTopicSubscriber(@NotNull Session session,
+ @NotNull Subscriber subscriber,
+ @NotNull String[] topicNames,
+ @NotNull MessageFilter filter) throws JMSException {
this.subscriber = subscriber;
this.filter = filter;
for (String t : topicNames) {
diff --git a/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java b/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java
index d926df4..7786d4b 100644
--- a/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java
+++ b/src/test/java/org/apache/sling/amq/ActiveMQConnectionFactoryServiceTest.java
@@ -22,7 +22,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import javax.annotation.Nonnull;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Message;
@@ -31,6 +30,7 @@
import javax.jms.TextMessage;
import javax.jms.Topic;
+import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.mockito.Mockito;
import org.slf4j.Logger;
@@ -67,11 +67,11 @@
deactivate(cfs);
}
- public static void deactivate(@Nonnull ActiveMQConnectionFactoryService cfs) {
+ public static void deactivate(@NotNull ActiveMQConnectionFactoryService cfs) {
cfs.deactivate();
}
- @Nonnull
+ @NotNull
public static ActiveMQConnectionFactoryService activate() {
ActiveMQConnectionFactoryService amqConnectionFactoryService = new ActiveMQConnectionFactoryService();
final ActiveMQConnectionFactoryService.Config config = Mockito.mock(ActiveMQConnectionFactoryService.Config.class);
@@ -80,4 +80,4 @@
return amqConnectionFactoryService;
}
-}
\ No newline at end of file
+}