Migrate mdsal-dom-api to JDT annotations 48/76748/12
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Oct 2018 12:17:30 +0000 (14:17 +0200)
committerJie Han <han.jie@zte.com.cn>
Tue, 9 Oct 2018 06:44:57 +0000 (06:44 +0000)
This removes the use of javax.annotation nullable annotations
to remove import-package.

JIRA: MDSAL-373
Change-Id: Ida93d05898d6b9d967e240096feb4d1092e02e87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
25 files changed:
dom/mdsal-dom-api/pom.xml
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeListener.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeChangeService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCommitCohort.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursor.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursorAwareTransaction.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeCursorProvider.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeListener.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeLoopException.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeProducer.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeProducerFactory.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeReadCursor.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShard.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShardingConflictException.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMDataTreeShardingService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotification.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationListener.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationPublishService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMNotificationService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcAvailabilityListener.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcImplementation.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcProviderService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMRpcService.java
dom/mdsal-dom-api/src/test/java/org/opendaylight/controller/md/sal/dom/api/AbstractDOMDataTreeServiceTestSuite.java

index e75088b1ea0613bc7ecc990c26cec6357bd43726..fe856c52f4879659595463c8c96f3ebe98af63a7 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index efe66b4b4a337ce75d3b1c6395a2666f6b311ed2..2ae4f780dbb322495302c18321193dce865ea62b 100644 (file)
@@ -9,35 +9,31 @@ package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 /**
- * Interface implemented by classes interested in receiving notifications about
- * data tree changes. It provides a cursor-based view of the change.
+ * Interface implemented by classes interested in receiving notifications about data tree changes. It provides
+ * a cursor-based view of the change.
  */
 public interface DOMDataTreeChangeListener extends EventListener {
     /**
-     * Invoked when there was data change for the supplied path, which was used
-     * to register this listener.
+     * Invoked when there was data change for the supplied path, which was used to register this listener.
      *
      * <p>
-     * This method may be also invoked during registration of the listener if
-     * there is any pre-existing data in the conceptual data tree for supplied
-     * path. This initial event will contain all pre-existing data as created.
+     * This method may be also invoked during registration of the listener if there is any pre-existing data
+     * in the conceptual data tree for supplied path. This initial event will contain all pre-existing data as created.
      *
      * <p>
-     * A data change event may be triggered spuriously, e.g. such that data before
-     * and after compare as equal. Implementations of this interface are expected
-     * to recover from such events. Event producers are expected to exert reasonable
-     * effort to suppress such events.
-     * In other words, it is completely acceptable to observe
-     * a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode},
-     * which reports a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType}
-     * other than UNMODIFIED, while the before- and after- data items compare as
-     * equal.
+     * A data change event may be triggered spuriously, e.g. such that data before and after compare as equal.
+     * Implementations of this interface are expected to recover from such events. Event producers are expected to exert
+     * reasonable effort to suppress such events. In other words, it is completely acceptable to observe
+     * a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode}, which reports
+     * a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType} other than UNMODIFIED, while
+     * the before- and after- data items compare as equal.
      *
      * @param changes Collection of change events, may not be null or empty.
+     * @throws NullPointerException if {@code changes} is null
      */
-    void onDataTreeChanged(@Nonnull Collection<DataTreeCandidate> changes);
+    void onDataTreeChanged(@NonNull Collection<DataTreeCandidate> changes);
 }
index e08892f1fb88ad427accf6d17edbf40ca8be1964..c7a13836b8f0ebe015606f57a1e2183a16d9f7ac 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 /**
@@ -46,7 +46,8 @@ public interface DOMDataTreeChangeService extends DOMDataBrokerExtension {
      * @param <L> Listener type
      * @return Listener registration object, which may be used to unregister your listener using
      *         {@link ListenerRegistration#close()} to stop delivery of change events.
+     * @throws NullPointerException if any of the arguments is null
      */
-    @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L>
-                          registerDataTreeChangeListener(@Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener);
+    <L extends DOMDataTreeChangeListener> @NonNull ListenerRegistration<L> registerDataTreeChangeListener(
+            @NonNull DOMDataTreeIdentifier treeId, @NonNull L listener);
 }
index 669a0ea258cbe46525ed54f6877a9c49c2925926..60dfbd8a8722edb3dc02b96d17171ad752de033a 100644 (file)
@@ -7,10 +7,12 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.DataValidationFailedException;
 import org.opendaylight.mdsal.common.api.PostCanCommitStep;
 import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
@@ -92,19 +94,18 @@ public interface DOMDataTreeCommitCohort {
      *         more specific subclasses of this exception to provide additional information about
      *         validation failure reason.
      */
-    @Nonnull
-    FluentFuture<PostCanCommitStep> canCommit(@Nonnull Object txId,
-            @Nonnull SchemaContext ctx, @Nonnull Collection<DOMDataTreeCandidate> candidates);
+    @NonNull FluentFuture<PostCanCommitStep> canCommit(@NonNull Object txId,
+            @NonNull SchemaContext ctx, @NonNull Collection<DOMDataTreeCandidate> candidates);
 
     /**
      * An ExceptionMapper that translates an Exception to a DataValidationFailedException.
      */
     class DataValidationFailedExceptionMapper extends ExceptionMapper<DataValidationFailedException> {
-        private final DOMDataTreeIdentifier failedTreeId;
+        private final @NonNull DOMDataTreeIdentifier failedTreeId;
 
         public DataValidationFailedExceptionMapper(final String opName, final DOMDataTreeIdentifier failedTreeId) {
             super(opName, DataValidationFailedException.class);
-            this.failedTreeId = failedTreeId;
+            this.failedTreeId = requireNonNull(failedTreeId);
         }
 
         @Override
index 99632a5111706e813b13cf970eb26440dc4ee060..a4c802ad5571de7ebeba0dd74567335dc7695881 100644 (file)
@@ -9,8 +9,8 @@ package org.opendaylight.mdsal.dom.api;
 
 import com.google.common.annotations.Beta;
 import java.util.Arrays;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
 
@@ -28,7 +28,7 @@ public interface DOMDataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified identifier does not identify a valid child,
      *         or if that child is not an instance of {@link NormalizedNodeContainer}.
      */
-    void enter(@Nonnull PathArgument child);
+    void enter(@NonNull PathArgument child);
 
     /**
      * Move the cursor to the specified child of the current position. This is the equivalent of
@@ -39,7 +39,7 @@ public interface DOMDataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified path does not identify a valid child, or if
      *         that child is not an instance of {@link NormalizedNodeContainer}.
      */
-    default void enter(@Nonnull final PathArgument... path) {
+    default void enter(final @NonNull PathArgument... path) {
         enter(Arrays.asList(path));
     }
 
@@ -51,7 +51,7 @@ public interface DOMDataTreeCursor extends AutoCloseable {
      * @throws IllegalArgumentException when specified path does not identify a valid child, or if
      *         that child is not an instance of {@link NormalizedNodeContainer}.
      */
-    void enter(@Nonnull Iterable<PathArgument> path);
+    void enter(@NonNull Iterable<PathArgument> path);
 
     /**
      * Move the cursor up to the parent of current position. This is equivalent of invoking
index 1c449fdecfb067c6ac71892945b8df0393b2e167..6bec2776b34c9d6ebda2b9974f8ca2a3ed8521f4 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.mdsal.dom.api;
 
 import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.TransactionCommitFailedException;
@@ -29,7 +27,7 @@ public interface DOMDataTreeCursorAwareTransaction extends DOMDataTreeCursorProv
      * @throws IllegalStateException when there's an open cursor, or this transaction is closed already.
      */
     @Override
-    @Nullable DOMDataTreeWriteCursor createCursor(@Nonnull DOMDataTreeIdentifier path);
+    DOMDataTreeWriteCursor createCursor(DOMDataTreeIdentifier path);
 
     /**
      * Cancels the transaction.
index f8f0396f26e4cbdac46f17b6a79c8f6958d06e49..99785613ca76ea944eb843083cb126e1019ac15d 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModificationCursor;
 
 public interface DOMDataTreeCursorProvider {
-
     /**
      * Create a new {@link DataTreeModificationCursor} at specified path. May fail if specified path
      * does not exist.
@@ -22,7 +21,5 @@ public interface DOMDataTreeCursorProvider {
      * @throws IllegalStateException if there is another cursor currently open, or the transaction
      *         is already closed (closed or submitted).
      */
-    @Nullable
-    DOMDataTreeCursor createCursor(@Nonnull DOMDataTreeIdentifier path);
-
+    @Nullable DOMDataTreeCursor createCursor(@NonNull DOMDataTreeIdentifier path);
 }
index 3c8edc1e3a4816f9623bb6f730bd2d14163ba77c..d3c191164c352853ee3e09c57310541e0eb850ce 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.mdsal.dom.api;
 import java.util.Collection;
 import java.util.EventListener;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
@@ -29,8 +29,8 @@ public interface DOMDataTreeListener extends EventListener {
      *                 This includes all the subtrees this listener is subscribed to, even those
      *                 which have not changed.
      */
-    void onDataTreeChanged(@Nonnull Collection<DataTreeCandidate> changes,
-            @Nonnull Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees);
+    void onDataTreeChanged(@NonNull Collection<DataTreeCandidate> changes,
+            @NonNull Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees);
 
     /**
      * Invoked when a subtree listening failure occurs. This can be triggered, for example, when a
@@ -39,5 +39,5 @@ public interface DOMDataTreeListener extends EventListener {
      *
      * @param causes Collection of failure causes, may not be null or empty.
      */
-    void onDataTreeFailed(@Nonnull Collection<DOMDataTreeListeningException> causes);
+    void onDataTreeFailed(@NonNull Collection<DOMDataTreeListeningException> causes);
 }
index 27a4982a841024b661f16f260ca6f41553c86c93..c3430cd473a31312b520f05590fd91649940220c 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Exception thrown when a loop is detected in the way {@link DOMDataTreeListener}
@@ -16,11 +16,11 @@ import javax.annotation.Nonnull;
 public class DOMDataTreeLoopException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    public DOMDataTreeLoopException(@Nonnull final String message) {
+    public DOMDataTreeLoopException(@NonNull final String message) {
         super(message);
     }
 
-    public DOMDataTreeLoopException(@Nonnull final String message, @Nonnull final Throwable cause) {
+    public DOMDataTreeLoopException(@NonNull final String message, @NonNull final Throwable cause) {
         super(message, cause);
     }
 }
index f6aae1d1dbd95d261d9f1333621afccec12ee4c4..0414d12a537741887d69739650e59a23dbf89567 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A data producer context. It allows transactions to be submitted to the subtrees
@@ -59,7 +59,7 @@ public interface DOMDataTreeProducer extends DOMDataTreeProducerFactory, AutoClo
      *         exception is thrown on a best effort basis and programs should not rely on it for
      *         correct operation.
      */
-    @Nonnull DOMDataTreeCursorAwareTransaction createTransaction(boolean isolated);
+    @NonNull DOMDataTreeCursorAwareTransaction createTransaction(boolean isolated);
 
     /**
      * {@inheritDoc}.
@@ -86,7 +86,7 @@ public interface DOMDataTreeProducer extends DOMDataTreeProducerFactory, AutoClo
      *         correct operation.
      */
     @Override
-    @Nonnull DOMDataTreeProducer createProducer(@Nonnull Collection<DOMDataTreeIdentifier> subtrees);
+    DOMDataTreeProducer createProducer(Collection<DOMDataTreeIdentifier> subtrees);
 
     /**
      * {@inheritDoc}.
index 887a8eca0598e71682a3dcf410590af201732846..a59cc299075e95555c159b3d55fc942be893f114 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Base source of {@link DOMDataTreeProducer}s. This interface is usually not used directly,
@@ -22,5 +22,5 @@ public interface DOMDataTreeProducerFactory {
      * @return A {@link DOMDataTreeProducer} instance.
      * @throws IllegalArgumentException if subtrees is empty.
      */
-    @Nonnull DOMDataTreeProducer createProducer(@Nonnull Collection<DOMDataTreeIdentifier> subtrees);
+    @NonNull DOMDataTreeProducer createProducer(@NonNull Collection<DOMDataTreeIdentifier> subtrees);
 }
index 3f625a859deb330447ed37bf650e9bb6fab954e5..d1271c0a454fc2c700e81d80a75c1721e788e60c 100644 (file)
@@ -9,13 +9,12 @@ package org.opendaylight.mdsal.dom.api;
 
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.ReadFailedException;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 public interface DOMDataTreeReadCursor extends DOMDataTreeCursor {
-
     /**
      * Read a particular node from the snapshot.
      *
@@ -31,7 +30,7 @@ public interface DOMDataTreeReadCursor extends DOMDataTreeCursor {
      *         </ul>
      * @throws IllegalArgumentException when specified path does not identify a valid child.
      */
-    FluentFuture<Optional<NormalizedNode<?, ?>>> readNode(@Nonnull PathArgument child);
+    @NonNull FluentFuture<Optional<NormalizedNode<?, ?>>> readNode(@NonNull PathArgument child);
 
     /**
      * Checks if data is available in the logical data store located at provided path.
@@ -53,5 +52,5 @@ public interface DOMDataTreeReadCursor extends DOMDataTreeCursor {
      *         ReadFailedException.</li>
      *         </ul>
      */
-    FluentFuture<Boolean> exists(@Nonnull PathArgument child);
+    @NonNull FluentFuture<Boolean> exists(@NonNull PathArgument child);
 }
index f4b21354941aa771331adae6de5b3e2c4d8cb6bd..cc25c96c65f0cae11525c251c167750d9a50f9be 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 /**
@@ -62,7 +62,7 @@ public interface DOMDataTreeService extends DOMDataTreeProducerFactory,
      *                                  subtrees with specified producers would form a
      *                                  feedback loop
      */
-    @Nonnull <T extends DOMDataTreeListener> ListenerRegistration<T> registerListener(@Nonnull T listener,
-            @Nonnull Collection<DOMDataTreeIdentifier> subtrees, boolean allowRxMerges,
-            @Nonnull Collection<DOMDataTreeProducer> producers) throws DOMDataTreeLoopException;
+    @NonNull <T extends DOMDataTreeListener> ListenerRegistration<T> registerListener(@NonNull T listener,
+            @NonNull Collection<DOMDataTreeIdentifier> subtrees, boolean allowRxMerges,
+            @NonNull Collection<DOMDataTreeProducer> producers) throws DOMDataTreeLoopException;
 }
index 1581f0e223852138e137bdabbde38fdaae78543b..ae1bba2846dc9b572f10d2ace47f3a8dace63503 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A single shard of the conceptual data tree. This interface defines the basic notifications
@@ -23,7 +23,7 @@ public interface DOMDataTreeShard extends EventListener {
      * @param prefix Child's prefix
      * @param child Child shard
      */
-    void onChildAttached(@Nonnull DOMDataTreeIdentifier prefix, @Nonnull DOMDataTreeShard child);
+    void onChildAttached(@NonNull DOMDataTreeIdentifier prefix, @NonNull DOMDataTreeShard child);
 
     /**
      * Invoked whenever a child is getting detached as a more specific prefix under this shard.
@@ -31,5 +31,5 @@ public interface DOMDataTreeShard extends EventListener {
      * @param prefix Child's prefix
      * @param child Child shard
      */
-    void onChildDetached(@Nonnull DOMDataTreeIdentifier prefix, @Nonnull DOMDataTreeShard child);
+    void onChildDetached(@NonNull DOMDataTreeIdentifier prefix, @NonNull DOMDataTreeShard child);
 }
index 9765eb40d817d87ac834f58475ba227028d30875..d235b70e67903f41f16d1ee020a341de145b0b3b 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Exception thrown when an attempt to attach a conflicting shard to the global
@@ -16,11 +16,11 @@ import javax.annotation.Nonnull;
 public class DOMDataTreeShardingConflictException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    public DOMDataTreeShardingConflictException(@Nonnull final String message) {
+    public DOMDataTreeShardingConflictException(final @NonNull String message) {
         super(message);
     }
 
-    public DOMDataTreeShardingConflictException(@Nonnull final String message, @Nonnull final Throwable cause) {
+    public DOMDataTreeShardingConflictException(final @NonNull String message, final @NonNull Throwable cause) {
         super(message, cause);
     }
 }
index 4a4255c4f268816a515451d79bf452a02e402c19..a2182801c1d7f91cd419f2646b63a0ccc43d131c 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 /**
@@ -36,7 +36,7 @@ public interface DOMDataTreeShardingService extends DOMService {
      * @return A registration. To remove the shard's binding, close the registration.
      * @throws DOMDataTreeShardingConflictException if the prefix is already bound
      */
-    @Nonnull <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(
-            @Nonnull DOMDataTreeIdentifier prefix, @Nonnull T shard,
-            @Nonnull DOMDataTreeProducer producer) throws DOMDataTreeShardingConflictException;
+    <T extends DOMDataTreeShard> @NonNull ListenerRegistration<T> registerDataTreeShard(
+            @NonNull DOMDataTreeIdentifier prefix, @NonNull T shard,
+            @NonNull DOMDataTreeProducer producer) throws DOMDataTreeShardingConflictException;
 }
index ca8f4e42d739af59f9d2be25832f81f9f83f9772..0d0438c55a8e3669efd1a81ba33dbf885c94034b 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
@@ -20,12 +20,12 @@ public interface DOMNotification {
      *
      * @return Notification type.
      */
-    @Nonnull SchemaPath getType();
+    @NonNull SchemaPath getType();
 
     /**
      * Return the body of this notification.
      *
      * @return Notification body.
      */
-    @Nonnull ContainerNode getBody();
+    @NonNull ContainerNode getBody();
 }
index ed26821b84cba6e303d901997d575a57cd17b533..b75a5405e9990a411d8c6722d8bf67ea0757c2ab 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Interface implemented by listeners interested in {@link DOMNotification}s.
@@ -20,5 +20,5 @@ public interface DOMNotificationListener extends EventListener {
      *
      * @param notification Received notification
      */
-    void onNotification(@Nonnull DOMNotification notification);
+    void onNotification(@NonNull DOMNotification notification);
 }
index a55edb3db40d0a9d2af30a465c0e59f71f301cd4..f4d76593af826ac309a1d7eda4c346cf225a320f 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
-import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.concurrent.TimeUnit;
 import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 
 /**
  * A {@link DOMService} which allows its user to send {@link DOMNotification}s. It
@@ -28,7 +28,7 @@ public interface DOMNotificationPublishService extends DOMService {
      * Well-known value indicating that the implementation is currently not
      * able to accept a notification.
      */
-    ListenableFuture<Object> REJECTED = Futures.immediateFailedFuture(
+    ListenableFuture<Object> REJECTED = FluentFutures.immediateFailedFluentFuture(
         new DOMNotificationRejectedException("Unacceptable blocking conditions encountered"));
 
     /**
@@ -61,7 +61,7 @@ public interface DOMNotificationPublishService extends DOMService {
      * @throws InterruptedException if interrupted while waiting
      * @throws NullPointerException if notification is null.
      */
-    @Nonnull ListenableFuture<? extends Object> putNotification(@Nonnull DOMNotification notification)
+    @NonNull ListenableFuture<? extends Object> putNotification(@NonNull DOMNotification notification)
             throws InterruptedException;
 
     /**
@@ -79,7 +79,7 @@ public interface DOMNotificationPublishService extends DOMService {
      *         delivery.
      * @throws NullPointerException if notification is null.
      */
-    @Nonnull ListenableFuture<? extends Object> offerNotification(@Nonnull DOMNotification notification);
+    @NonNull ListenableFuture<? extends Object> offerNotification(@NonNull DOMNotification notification);
 
     /**
      * Attempt to publish a notification. The result of this method is a {@link ListenableFuture}
@@ -100,6 +100,6 @@ public interface DOMNotificationPublishService extends DOMService {
      * @throws NullPointerException if notification or unit is null.
      * @throws IllegalArgumentException if timeout is negative.
      */
-    @Nonnull ListenableFuture<? extends Object> offerNotification(@Nonnull DOMNotification notification,
-        @Nonnegative long timeout, @Nonnull TimeUnit unit) throws InterruptedException;
+    @NonNull ListenableFuture<? extends Object> offerNotification(@NonNull DOMNotification notification,
+            @Nonnegative long timeout, @NonNull TimeUnit unit) throws InterruptedException;
 }
index 4160d90c65e8aa785daf5253891964eba22e3fac..3bbff670a8f53d948d18b8edce85115ad1e106a6 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
@@ -32,7 +32,7 @@ public interface DOMNotificationService extends DOMService {
      * @throws NullPointerException if either of the arguments is null
      */
     <T extends DOMNotificationListener> ListenerRegistration<T>
-            registerNotificationListener(@Nonnull T listener, @Nonnull Collection<SchemaPath> types);
+            registerNotificationListener(@NonNull T listener, @NonNull Collection<SchemaPath> types);
 
     /**
      * Register a {@link DOMNotificationListener} to receive a set of notifications. As with other
@@ -50,5 +50,5 @@ public interface DOMNotificationService extends DOMService {
      */
     // FIXME: Java 8: provide a default implementation of this method.
     <T extends DOMNotificationListener> ListenerRegistration<T>
-            registerNotificationListener(@Nonnull T listener, SchemaPath... types);
+            registerNotificationListener(@NonNull T listener, SchemaPath... types);
 }
index 3c69ed93e2866d22f86f615f3f4f94fc7284223a..137205db5c2763ca55e2c6718599cc6c63692d0f 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.mdsal.dom.api;
 
 import java.util.Collection;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * An {@link EventListener} used to track RPC implementations becoming (un)available
@@ -21,14 +21,14 @@ public interface DOMRpcAvailabilityListener extends EventListener {
      *
      * @param rpcs RPC types newly available
      */
-    void onRpcAvailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+    void onRpcAvailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
 
     /**
      * Method invoked whenever an RPC type becomes unavailable.
      *
      * @param rpcs RPC types which became unavailable
      */
-    void onRpcUnavailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+    void onRpcUnavailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
 
     /**
      * Implementation filtering method. This method is useful for forwarding RPC implementations,
index 8d5adb4fed5865a56ed5ff89a7d5ba0e77b05acc..5cef886787a5158c0187cdcbda5ff6ba128a13ae 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.mdsal.dom.api;
 
 import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 /**
@@ -27,7 +27,8 @@ public interface DOMRpcImplementation {
      *         or report a subclass of {@link DOMRpcException} reporting a transport
      *         error.
      */
-    @Nonnull FluentFuture<DOMRpcResult> invokeRpc(@Nonnull DOMRpcIdentifier rpc, @Nullable NormalizedNode<?, ?> input);
+    // FIXME: 4.0.0: do not allow null input
+    @NonNull FluentFuture<DOMRpcResult> invokeRpc(@NonNull DOMRpcIdentifier rpc, @Nullable NormalizedNode<?, ?> input);
 
     /**
      * Return the relative invocation cost of this implementation. Default implementation return 0.
index 9edc47f9f159f523bf29dd1d40101bbf98fd600d..224c6ada2c4f24a3a7ff18ff68caef2adf6418ca 100644 (file)
@@ -8,11 +8,11 @@
 package org.opendaylight.mdsal.dom.api;
 
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
- * A {@link DOMService} which allows registration of RPC implementations with a conceptual
- * router. The client counterpart of this service is {@link DOMRpcService}.
+ * A {@link DOMService} which allows registration of RPC implementations with a conceptual router. The client
+ * counterpart of this service is {@link DOMRpcService}.
  */
 public interface DOMRpcProviderService extends DOMService {
     /**
@@ -25,8 +25,8 @@ public interface DOMRpcProviderService extends DOMService {
      * @throws NullPointerException if implementation or types is null
      * @throws IllegalArgumentException if types is empty or contains a null element.
      */
-    @Nonnull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T>
-        registerRpcImplementation(@Nonnull T implementation, @Nonnull DOMRpcIdentifier... rpcs);
+    @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T>
+        registerRpcImplementation(@NonNull T implementation, @NonNull DOMRpcIdentifier... rpcs);
 
     /**
      * Register an {@link DOMRpcImplementation} object with this service.
@@ -37,6 +37,6 @@ public interface DOMRpcProviderService extends DOMService {
      * @throws NullPointerException if implementation or types is null
      * @throws IllegalArgumentException if types is empty or contains a null element.
      */
-    @Nonnull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T>
-        registerRpcImplementation(@Nonnull T implementation, @Nonnull Set<DOMRpcIdentifier> rpcs);
+    @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T>
+        registerRpcImplementation(@NonNull T implementation, @NonNull Set<DOMRpcIdentifier> rpcs);
 }
index 3f64416a49619b584236b0f55ab34ee706188f4d..7b23ee73590f2af61e5f8119064424e26b11d8a5 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.mdsal.dom.api;
 
 import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -27,11 +27,11 @@ public interface DOMRpcService extends DOMService {
      *
      * @param type SchemaPath of the RPC to be invoked
      * @param input Input arguments, null if the RPC does not take any.
-     * @return A {@link FluentFuture} which will return either a result structure,
-     *         or report a subclass of {@link DOMRpcException} reporting a transport
-     *         error.
+     * @return A {@link FluentFuture} which will return either a result structure, or report a subclass
+     *         of {@link DOMRpcException} reporting a transport error.
      */
-    @Nonnull FluentFuture<DOMRpcResult> invokeRpc(@Nonnull SchemaPath type, @Nullable NormalizedNode<?, ?> input);
+    // FIXME: 4.0.0: do not allow null input
+    @NonNull FluentFuture<DOMRpcResult> invokeRpc(@NonNull SchemaPath type, @Nullable NormalizedNode<?, ?> input);
 
     /**
      * Register a {@link DOMRpcAvailabilityListener} with this service to receive notifications
@@ -45,8 +45,7 @@ public interface DOMRpcService extends DOMService {
      *
      * @param listener {@link DOMRpcAvailabilityListener} instance to register
      * @return A {@link ListenerRegistration} representing this registration. Performing a
-     *         {@link ListenerRegistration#close()} will cancel it. Returned object is guaranteed to
-     *         be non-null.
+     *         {@link ListenerRegistration#close()} will cancel it. Returned object is guaranteed to be non-null.
      */
-    @Nonnull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@Nonnull T listener);
+    @NonNull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@NonNull T listener);
 }
index 60631c78bc7dd4d0873293d1c757878a8cdc7def..e89f9f1f9143874b87056d88c4638300422bbe17 100644 (file)
@@ -13,7 +13,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.net.URI;
 import java.util.Collections;
 import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.junit.Test;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction;
@@ -49,7 +49,7 @@ public abstract class AbstractDOMDataTreeServiceTestSuite {
      *
      * @return {@link DOMDataTreeService} instance.
      */
-    protected abstract @Nonnull DOMDataTreeService service();
+    protected abstract @NonNull DOMDataTreeService service();
 
     /**
      * A simple unbound producer. It write some basic things into the data store based on the