Make Delegator.getDelegate() non-null 37/77237/13
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Oct 2018 23:58:59 +0000 (01:58 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 24 Oct 2018 10:12:28 +0000 (12:12 +0200)
The implied intent is that the delegate is always non-null. Fix this
up.

Change-Id: I29f21eeafd724ee3799db736c9a4bbb6bc4f1e3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/AbstractDelegator.java
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/Delegator.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/YangTextFileSchemaSource.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/YinTextFileSchemaSource.java

index aa4a7c35654561360e5a4961019add4ee286c5dc..531be250ce051152ce2e52e283397aa915f98fae 100644 (file)
@@ -12,6 +12,7 @@ import static java.util.Objects.requireNonNull;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 
 /**
@@ -23,7 +24,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 @Beta
 @NonNullByDefault
 public abstract class AbstractDelegator<T> implements Delegator<T> {
-    private final T delegate;
+    private final @NonNull T delegate;
 
     protected AbstractDelegator(final T delegate) {
         this.delegate = requireNonNull(delegate);
index 74509dc76440a754b1fb7b638f12af1161538aee..78325fb4d52b7ff5581bf7a71435f37cf09b70c4 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.yangtools.concepts;
 
+import org.eclipse.jdt.annotation.NonNull;
+
 /**
- * Implementation of this interface delegates all it's calls to the delegate if not specified otherwise.
+ * Implementation of this interface delegates all its calls to the delegate if not specified otherwise.
  *
  * @param <T> Type of delegate
  */
@@ -18,5 +20,5 @@ public interface Delegator<T> {
      *
      * @return underlying delegate.
      */
-    T getDelegate();
+    @NonNull T getDelegate();
 }
index 09cb9d838b8e6fbed935426d0182b54d5c3901c5..de5f0d0a477ef0751e34f766df4254ebdfe58af7 100644 (file)
@@ -15,6 +15,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Delegator;
 
 /**
@@ -23,7 +24,7 @@ import org.opendaylight.yangtools.concepts.Delegator;
  * @author Robert Varga
  */
 final class YangTextFileSchemaSource extends YangTextSchemaSource implements Delegator<File> {
-    private final File file;
+    private final @NonNull File file;
 
     YangTextFileSchemaSource(final SourceIdentifier identifier, final File file) {
         super(identifier);
index c3ec26f68f267747f5e44ccafadccafb44483fff..f900b8c3de974c390325d5c31262cae12e0a69b6 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.concepts.Delegator;
  * @author Robert Varga
  */
 final class YinTextFileSchemaSource extends YinTextSchemaSource implements Delegator<File> {
-    private final File file;
+    private final @NonNull File file;
 
     YinTextFileSchemaSource(final @NonNull SourceIdentifier identifier, final @NonNull File file) {
         super(identifier);