Migrate UniqueConstraint to JDT annotations 14/77214/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Oct 2018 14:12:51 +0000 (16:12 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Oct 2018 14:16:24 +0000 (16:16 +0200)
This migrates the simple use of @Nonnull to JDT use, guarding
the implementation with verifyNotNull().

Change-Id: I4310fffd0c1934668ad9dc14b1675694a51bb722
JIRA: YANGTOOLS-907
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UniqueConstraint.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/unique/UniqueEffectiveStatementImpl.java

index fb4319eca6e82f16e6bb87c9c564432f4e783371..eb21b719eadf5230fd29f8d735b0739ac7d90ecb 100644 (file)
@@ -9,20 +9,19 @@ package org.opendaylight.yangtools.yang.model.api;
 
 import com.google.common.annotations.Beta;
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Relative;
 
 /**
  * Interface describing YANG 'unique' constraint.
  *
  * <p>
- * The 'unique' constraint specifies that the combined values of all the leaf
- * instances specified in the argument string, including leafs with default
- * values, MUST be unique within all list entry instances in which all
- * referenced leafs exist (for more information see RFC-6020 section 7.8.3.).
+ * The 'unique' constraint specifies that the combined values of all the leaf instances specified in the argument
+ * string, including leafs with default values, MUST be unique within all list entry instances in which all referenced
+ * leafs exist (for more information see RFC-6020 section 7.8.3.).
  */
 @Beta
 public interface UniqueConstraint {
     // FIXME: 3.0.0: return Set<Relative>
-    @Nonnull Collection<Relative> getTag();
+    @NonNull Collection<Relative> getTag();
 }
index 3354ef8a3c5826b3176175477a03309b458a45a7..ebc842efb62000ad726cbcdaeaf6cb52c0a8db2b 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.unique;
 
+import static com.google.common.base.Verify.verifyNotNull;
+
 import java.util.Collection;
-import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.model.api.UniqueConstraint;
 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Relative;
 import org.opendaylight.yangtools.yang.model.api.stmt.UniqueEffectiveStatement;
@@ -22,9 +23,9 @@ final class UniqueEffectiveStatementImpl extends DeclaredEffectiveStatementBase<
         super(ctx);
     }
 
-    @Nonnull
     @Override
     public Collection<Relative> getTag() {
-        return argument();
+        // FIXME: YANGTOOLS-908: verifyNotNull() should not be needed here
+        return verifyNotNull(argument());
     }
 }