Fix buildType() nullness 95/88495/5
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 18 Mar 2020 14:22:25 +0000 (15:22 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 18 Mar 2020 18:22:35 +0000 (19:22 +0100)
We have a slight inconsistency here, as we are peeling buildType()
implementation, without also propagaing @NonNull. Fix that up.

Change-Id: I7b2e79f28f02bc81a8d06a101ef3e4bd34b9848b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/LengthRestrictedTypeBuilder.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/RangeRestrictedTypeBuilderWithBase.java

index e0b989ff353a7ab02c89bd4c3e0deaf9e45efd70..e7056dfccf636a232b85ad75f3c01f8af21256d9 100644 (file)
@@ -75,7 +75,7 @@ public abstract class LengthRestrictedTypeBuilder<T extends LengthRestrictedType
         touch();
     }
 
-    abstract T buildType(LengthConstraint constraint);
+    abstract @NonNull T buildType(LengthConstraint constraint);
 
     @Override
     final T buildType() {
index 5f8e1fdb0be613e6fcb8f793b7f7e51798994ffd..9045b0a39e89923f29c8285efd3fb0dea697102f 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.yangtools.yang.model.util.type;
 
 import static java.util.Objects.requireNonNull;
 
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.RangeRestrictedTypeDefinition;
@@ -25,5 +26,5 @@ abstract class RangeRestrictedTypeBuilderWithBase<T extends RangeRestrictedTypeD
         return buildType(calculateRangeConstraint(getBaseType().getRangeConstraint().get()));
     }
 
-    abstract T buildType(RangeConstraint<N> rangeConstraints);
+    abstract @NonNull T buildType(RangeConstraint<N> rangeConstraints);
 }