Migrate IdentitySchemaNode to JDT annotations 09/77209/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Oct 2018 13:56:19 +0000 (15:56 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Oct 2018 13:57:19 +0000 (15:57 +0200)
Rather than using JSR-305, migrate IdentitySchemaNode and its
implementation to JDT annotations.

Change-Id: I7e1ca793c86ca6a2576292cf0791dcaa17a5d346
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/IdentitySchemaNode.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/identity/IdentityEffectiveStatementImpl.java

index b385d3d20a2280457f4d61c99a239b5c94022c9d..42ae9735087c1636e432d78b63c1acebb7511775 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.yangtools.yang.model.api;
 
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Interface describing YANG 'identity' statement.
@@ -30,12 +30,12 @@ public interface IdentitySchemaNode extends SchemaNode {
      * @return set of existing identities from which the new identity is derived or an empty Set if the identity is
      *         a root identity.
      */
-    @Nonnull Set<IdentitySchemaNode> getBaseIdentities();
+    @NonNull Set<IdentitySchemaNode> getBaseIdentities();
 
     /**
      * Get identities derived from this identity.
      *
      * @return collection of identities derived from this identity
      */
-    Set<IdentitySchemaNode> getDerivedIdentities();
+    @NonNull Set<IdentitySchemaNode> getDerivedIdentities();
 }
index 2a00f65460af732e6bec7577def0b333815a36d4..8a1ec9431d127a45af655f614369bffbaa20f687 100644 (file)
@@ -7,15 +7,16 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt.identity;
 
+import static com.google.common.base.Preconditions.checkState;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
@@ -29,7 +30,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 final class IdentityEffectiveStatementImpl extends AbstractEffectiveSchemaNode<IdentityStatement>
         implements IdentityEffectiveStatement, IdentitySchemaNode, MutableStatement {
     private final Set<IdentitySchemaNode> derivedIdentities;
-    private Set<IdentitySchemaNode> baseIdentities;
+    private @NonNull Set<IdentitySchemaNode> baseIdentities;
     private boolean sealed;
 
     IdentityEffectiveStatementImpl(
@@ -57,15 +58,13 @@ final class IdentityEffectiveStatementImpl extends AbstractEffectiveSchemaNode<I
     }
 
     private void addBaseIdentity(final IdentityEffectiveStatementImpl baseIdentity) {
-        Preconditions.checkState(!sealed, "Attempt to modify sealed identity effective statement %s", getQName());
+        checkState(!sealed, "Attempt to modify sealed identity effective statement %s", getQName());
         this.baseIdentities.add(baseIdentity);
     }
 
-    @Nonnull
     @Override
     public Set<IdentitySchemaNode> getBaseIdentities() {
-        Preconditions.checkState(sealed,
-                "Attempt to get base identities from unsealed identity effective statement %s", getQName());
+        checkState(sealed, "Attempt to get base identities from unsealed identity effective statement %s", getQName());
         return baseIdentities;
     }