From be802c0ed200e53b43134cb55f6b41c9ec430b91 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 24 Oct 2018 01:44:52 +0200 Subject: [PATCH] Migrate yang-model-util annotations This moves over to use JDT annotations instead of JSR305. Change-Id: I98d70e53a951d41c3533272da016fb8afa223a49 JIRA: YANGTOOLS-907 Signed-off-by: Robert Varga --- yang/yang-model-util/pom.xml | 9 - .../repo/util/AbstractSchemaRepository.java | 7 +- .../repo/util/SchemaSourceTransformer.java | 3 +- .../util/FilteringSchemaContextProxy.java | 1 - .../yang/model/util/SchemaContextUtil.java | 172 ++++++++---------- .../yang/model/util/SchemaNodeUtils.java | 12 +- .../AbstractLengthRestrictedDerivedType.java | 2 - .../type/AbstractRangeRestrictedBaseType.java | 2 - .../AbstractRangeRestrictedDerivedType.java | 2 - .../type/AbstractRangeRestrictedType.java | 2 - .../type/AbstractRestrictedTypeBuilder.java | 12 +- .../yang/model/util/type/BaseBinaryType.java | 3 +- .../yang/model/util/type/BaseBooleanType.java | 3 +- .../yang/model/util/type/BaseEmptyType.java | 3 +- .../util/type/BaseInstanceIdentifierType.java | 3 +- .../yang/model/util/type/BaseInt16Type.java | 3 +- .../yang/model/util/type/BaseInt32Type.java | 3 +- .../yang/model/util/type/BaseInt64Type.java | 3 +- .../yang/model/util/type/BaseInt8Type.java | 3 +- .../yang/model/util/type/BaseStringType.java | 3 +- .../yang/model/util/type/BaseTypes.java | 48 ++--- .../yang/model/util/type/BaseUint16Type.java | 3 +- .../yang/model/util/type/BaseUint32Type.java | 3 +- .../yang/model/util/type/BaseUint64Type.java | 3 +- .../yang/model/util/type/BaseUint8Type.java | 3 +- .../yang/model/util/type/BitsTypeBuilder.java | 6 +- .../yang/model/util/type/CompatUtils.java | 29 +-- .../model/util/type/ConcreteTypeBuilder.java | 9 +- .../yang/model/util/type/ConcreteTypes.java | 29 +-- .../model/util/type/DerivedTypeBuilder.java | 10 +- .../yang/model/util/type/DerivedTypes.java | 66 +++---- .../util/type/EnumerationTypeBuilder.java | 24 ++- .../util/type/IdentityrefTypeBuilder.java | 4 +- .../type/InstanceIdentifierTypeBuilder.java | 13 +- .../model/util/type/LeafrefTypeBuilder.java | 12 +- .../yang/model/util/type/RestrictedTypes.java | 53 +++--- .../yang/model/util/type/TypeBuilder.java | 21 ++- .../model/util/type/UnionTypeBuilder.java | 4 +- .../util/SchemaSourceTransformerTest.java | 11 +- 39 files changed, 280 insertions(+), 322 deletions(-) diff --git a/yang/yang-model-util/pom.xml b/yang/yang-model-util/pom.xml index 029c358dff..1f33a616d7 100644 --- a/yang/yang-model-util/pom.xml +++ b/yang/yang-model-util/pom.xml @@ -41,15 +41,6 @@ - - org.apache.felix - maven-bundle-plugin - - - !javax.annotation,* - - - org.apache.maven.plugins maven-checkstyle-plugin diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/AbstractSchemaRepository.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/AbstractSchemaRepository.java index e02ac79b5b..92adec7516 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/AbstractSchemaRepository.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/AbstractSchemaRepository.java @@ -26,7 +26,6 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import javax.annotation.Nonnull; import javax.annotation.concurrent.GuardedBy; import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException; import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository; @@ -83,8 +82,8 @@ public abstract class AbstractSchemaRepository implements SchemaRepository, Sche } @Override - public ListenableFuture getSchemaSource( - @Nonnull final SourceIdentifier id, @Nonnull final Class representation) { + public ListenableFuture getSchemaSource(final SourceIdentifier id, + final Class representation) { final ArrayList> sortedSchemaSourceRegistrations; synchronized (this) { @@ -119,7 +118,7 @@ public abstract class AbstractSchemaRepository implements SchemaRepository, Sche @Override @SuppressWarnings("checkstyle:parameterName") - public void onFailure(@Nonnull final Throwable t) { + public void onFailure(final Throwable t) { LOG.trace("Skipping notification for encountered source {}, fetching source failed", id, t); } }, MoreExecutors.directExecutor()); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformer.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformer.java index 5053c1cf85..28539bbfaf 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformer.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformer.java @@ -15,7 +15,6 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository; import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation; import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier; @@ -32,7 +31,7 @@ public class SchemaSourceTransformer extends AsyncFunction { @Override - ListenableFuture apply(@Nonnull S input) throws Exception; + ListenableFuture apply(S input) throws Exception; } private final Map, RefcountedRegistration> availableSources = new HashMap<>(); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/FilteringSchemaContextProxy.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/FilteringSchemaContextProxy.java index 01c38c515e..f9251b00f4 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/FilteringSchemaContextProxy.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/FilteringSchemaContextProxy.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.yangtools.yang.model.util; import com.google.common.base.Preconditions; diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java index 2d2240c382..7b4140392b 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtil.java @@ -7,9 +7,12 @@ */ package org.opendaylight.yangtools.yang.model.util; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; +import static java.util.Objects.requireNonNull; + import com.google.common.annotations.Beta; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; import com.google.common.base.Splitter; import com.google.common.collect.Iterables; import java.util.HashSet; @@ -19,8 +22,8 @@ import java.util.List; import java.util.Optional; import java.util.Set; import java.util.regex.Pattern; -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.common.QName; import org.opendaylight.yangtools.yang.model.api.ActionNodeContainer; import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode; @@ -51,11 +54,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * The Schema Context Util contains support methods for searching through Schema - * Context modules for specified schema nodes via Schema Path or Revision Aware - * XPath. The Schema Context Util is designed as mixin, so it is not + * The Schema Context Util contains support methods for searching through Schema Context modules for specified schema + * nodes via Schema Path or Revision Aware XPath. The Schema Context Util is designed as mixin, so it is not * instantiable. - * */ public final class SchemaContextUtil { private static final Logger LOG = LoggerFactory.getLogger(SchemaContextUtil.class); @@ -83,8 +84,8 @@ public final class SchemaContextUtil { * @throws IllegalArgumentException if context or schemaPath is not correct. */ public static SchemaNode findDataSchemaNode(final SchemaContext context, final SchemaPath schemaPath) { - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(schemaPath != null, "Schema Path reference cannot be NULL"); + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(schemaPath != null, "Schema Path reference cannot be NULL"); final Iterable prefixedPath = schemaPath.getPathFromRoot(); if (prefixedPath == null) { @@ -138,14 +139,13 @@ public final class SchemaContextUtil { // that feels like an overkill. public static SchemaNode findDataSchemaNode(final SchemaContext context, final Module module, final RevisionAwareXPath nonCondXPath) { - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(module != null, "Module reference cannot be NULL"); - Preconditions.checkArgument(nonCondXPath != null, "Non Conditional Revision Aware XPath cannot be NULL"); + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(module != null, "Module reference cannot be NULL"); + checkArgument(nonCondXPath != null, "Non Conditional Revision Aware XPath cannot be NULL"); final String strXPath = nonCondXPath.toString(); if (strXPath != null) { - Preconditions.checkArgument(strXPath.indexOf('[') == -1, - "Revision Aware XPath may not contain a condition"); + checkArgument(strXPath.indexOf('[') == -1, "Revision Aware XPath may not contain a condition"); if (nonCondXPath.isAbsolute()) { final List path = xpathToQNamePath(context, module, strXPath); @@ -209,13 +209,12 @@ public final class SchemaContextUtil { // that feels like an overkill. public static SchemaNode findDataSchemaNodeForRelativeXPath(final SchemaContext context, final Module module, final SchemaNode actualSchemaNode, final RevisionAwareXPath relativeXPath) { - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(module != null, "Module reference cannot be NULL"); - Preconditions.checkArgument(actualSchemaNode != null, "Actual Schema Node reference cannot be NULL"); - Preconditions.checkArgument(relativeXPath != null, "Non Conditional Revision Aware XPath cannot be NULL"); - Preconditions.checkState(!relativeXPath.isAbsolute(), - "Revision Aware XPath MUST be relative i.e. MUST contains ../, " - + "for non relative Revision Aware XPath use findDataSchemaNode method"); + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(module != null, "Module reference cannot be NULL"); + checkArgument(actualSchemaNode != null, "Actual Schema Node reference cannot be NULL"); + checkArgument(relativeXPath != null, "Non Conditional Revision Aware XPath cannot be NULL"); + checkState(!relativeXPath.isAbsolute(), "Revision Aware XPath MUST be relative i.e. MUST contains ../, " + + "for non relative Revision Aware XPath use findDataSchemaNode method"); final SchemaPath actualNodePath = actualSchemaNode.getPath(); if (actualNodePath != null) { @@ -244,13 +243,13 @@ public final class SchemaContextUtil { * return null */ public static Module findParentModule(final SchemaContext context, final SchemaNode schemaNode) { - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL!"); - Preconditions.checkArgument(schemaNode != null, "Schema Node cannot be NULL!"); - Preconditions.checkState(schemaNode.getPath() != null, "Schema Path for Schema Node is not " - + "set properly (Schema Path is NULL)"); + checkArgument(context != null, "Schema Context reference cannot be NULL!"); + checkArgument(schemaNode != null, "Schema Node cannot be NULL!"); + checkState(schemaNode.getPath() != null, "Schema Path for Schema Node is not set properly (Schema Path is " + + "NULL)"); final QName qname = schemaNode.getPath().getLastComponent(); - Preconditions.checkState(qname != null, "Schema Path contains invalid state of path parts. " + checkState(qname != null, "Schema Path contains invalid state of path parts. " + "The Schema Path MUST contain at least ONE QName which defines namespace and Local name of path."); return context.findModule(qname.getModule()).orElse(null); } @@ -276,11 +275,10 @@ public final class SchemaContextUtil { * @return Notification schema or null, if notification is not present in schema context. */ @Beta - @Nullable - public static NotificationDefinition getNotificationSchema(@Nonnull final SchemaContext schema, - @Nonnull final SchemaPath path) { - Preconditions.checkNotNull(schema, "Schema context must not be null."); - Preconditions.checkNotNull(path, "Schema path must not be null."); + public static @Nullable NotificationDefinition getNotificationSchema(final @NonNull SchemaContext schema, + final @NonNull SchemaPath path) { + requireNonNull(schema, "Schema context must not be null."); + requireNonNull(path, "Schema path must not be null."); for (final NotificationDefinition potential : schema.getNotifications()) { if (path.equals(potential.getPath())) { return potential; @@ -297,15 +295,14 @@ public final class SchemaContextUtil { * @return Notification schema or null, if notification is not present in schema context. */ @Beta - @Nullable - public static ContainerSchemaNode getRpcDataSchema(@Nonnull final SchemaContext schema, - @Nonnull final SchemaPath path) { - Preconditions.checkNotNull(schema, "Schema context must not be null."); - Preconditions.checkNotNull(path, "Schema path must not be null."); + public static @Nullable ContainerSchemaNode getRpcDataSchema(final @NonNull SchemaContext schema, + final @NonNull SchemaPath path) { + requireNonNull(schema, "Schema context must not be null."); + requireNonNull(path, "Schema path must not be null."); final Iterator it = path.getPathFromRoot().iterator(); - Preconditions.checkArgument(it.hasNext(), "Rpc must have QName."); + checkArgument(it.hasNext(), "Rpc must have QName."); final QName rpcName = it.next(); - Preconditions.checkArgument(it.hasNext(), "input or output must be part of path."); + checkArgument(it.hasNext(), "input or output must be part of path."); final QName inOrOut = it.next(); for (final RpcDefinition potential : schema.getOperations()) { if (rpcName.equals(potential.getQName())) { @@ -340,9 +337,8 @@ public final class SchemaContextUtil { } private static SchemaNode findNodeInModule(final Module module, final Iterable path) { - - Preconditions.checkArgument(module != null, "Parent reference cannot be NULL"); - Preconditions.checkArgument(path != null, "Path reference cannot be NULL"); + checkArgument(module != null, "Parent reference cannot be NULL"); + checkArgument(path != null, "Path reference cannot be NULL"); if (!path.iterator().hasNext()) { LOG.debug("No node matching {} found in node {}", path, module); @@ -390,9 +386,8 @@ public final class SchemaContextUtil { } private static SchemaNode findNodeIn(final SchemaNode parent, final Iterable path) { - - Preconditions.checkArgument(parent != null, "Parent reference cannot be NULL"); - Preconditions.checkArgument(path != null, "Path reference cannot be NULL"); + checkArgument(parent != null, "Parent reference cannot be NULL"); + checkArgument(path != null, "Path reference cannot be NULL"); if (!path.iterator().hasNext()) { LOG.debug("No node matching {} found in node {}", path, parent); @@ -549,10 +544,10 @@ public final class SchemaContextUtil { */ private static List xpathToQNamePath(final SchemaContext context, final Module parentModule, final String xpath) { - // FIXME: 2.0.0: this should throw NPE, not IAE - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(parentModule != null, "Parent Module reference cannot be NULL"); - Preconditions.checkArgument(xpath != null, "XPath string reference cannot be NULL"); + // FIXME: 3.0.0: this should throw NPE, not IAE + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(parentModule != null, "Parent Module reference cannot be NULL"); + checkArgument(xpath != null, "XPath string reference cannot be NULL"); final List path = new LinkedList<>(); for (final String pathComponent : SLASH_SPLITTER.split(xpath)) { @@ -574,30 +569,26 @@ public final class SchemaContextUtil { * If Schema Context, Parent Module or Prefixed Path Part refers to * null the method will throw IllegalArgumentException * - * @param context - * Schema Context - * @param parentModule - * Parent Module - * @param prefixedPathPart - * Prefixed Path Part string + * @param context Schema Context + * @param parentModule Parent Module + * @param prefixedPathPart Prefixed Path Part string * @return QName from prefixed Path Part String. * @throws IllegalArgumentException if any arguments are null */ private static QName stringPathPartToQName(final SchemaContext context, final Module parentModule, final String prefixedPathPart) { - // FIXME: 2.0.0: this should throw NPE, not IAE - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(parentModule != null, "Parent Module reference cannot be NULL"); - Preconditions.checkArgument(prefixedPathPart != null, "Prefixed Path Part cannot be NULL!"); + // FIXME: 3.0.0: this should throw NPE, not IAE + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(parentModule != null, "Parent Module reference cannot be NULL"); + checkArgument(prefixedPathPart != null, "Prefixed Path Part cannot be NULL!"); if (prefixedPathPart.indexOf(':') != -1) { final Iterator prefixedName = COLON_SPLITTER.split(prefixedPathPart).iterator(); final String modulePrefix = prefixedName.next(); final Module module = resolveModuleForPrefix(context, parentModule, modulePrefix); - Preconditions.checkArgument(module != null, - "Failed to resolve xpath: no module found for prefix %s in module %s", modulePrefix, - parentModule.getName()); + checkArgument(module != null, "Failed to resolve xpath: no module found for prefix %s in module %s", + modulePrefix, parentModule.getName()); return QName.create(module.getQNameModule(), prefixedName.next()); } @@ -606,34 +597,26 @@ public final class SchemaContextUtil { } /** - * Method will attempt to resolve and provide Module reference for specified - * module prefix. Each Yang module could contains multiple imports which - * MUST be associated with corresponding module prefix. The method simply - * looks into module imports and returns the module that is bounded with - * specified prefix. If the prefix is not present in module or the prefixed - * module is not present in specified Schema Context, the method will return - * null.
- * If String prefix is the same as prefix of the specified Module the - * reference to this module is returned.
- * If Schema Context, Module or Prefix are referring to null - * the method will return IllegalArgumentException + * Method will attempt to resolve and provide Module reference for specified module prefix. Each Yang module could + * contains multiple imports which MUST be associated with corresponding module prefix. The method simply looks into + * module imports and returns the module that is bounded with specified prefix. If the prefix is not present + * in module or the prefixed module is not present in specified Schema Context, the method will return {@code null}. + *
+ * If String prefix is the same as prefix of the specified Module the reference to this module is returned.
+ * If Schema Context, Module or Prefix are referring to {@code null} the method will throw IllegalArgumentException. * - * @param context - * Schema Context - * @param module - * Yang Module - * @param prefix - * Module Prefix - * @return Module for given prefix in specified Schema Context if is - * present, otherwise returns null + * @param context Schema Context + * @param module Yang Module + * @param prefix Module Prefix + * @return Module for given prefix in specified Schema Context if is present, otherwise returns null * @throws IllegalArgumentException if any arguments are null */ private static Module resolveModuleForPrefix(final SchemaContext context, final Module module, final String prefix) { - // FIXME: 2.0.0: this should throw NPE, not IAE - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(module != null, "Module reference cannot be NULL"); - Preconditions.checkArgument(prefix != null, "Prefix string cannot be NULL"); + // FIXME: 3.0.0: this should throw NPE, not IAE + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(module != null, "Module reference cannot be NULL"); + checkArgument(prefix != null, "Prefix string cannot be NULL"); if (prefix.equals(module.getPrefix())) { return module; @@ -664,14 +647,13 @@ public final class SchemaContextUtil { */ private static Iterable resolveRelativeXPath(final SchemaContext context, final Module module, final RevisionAwareXPath relativeXPath, final SchemaNode actualSchemaNode) { - // FIXME: 2.0.0: this should throw NPE, not IAE - Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL"); - Preconditions.checkArgument(module != null, "Module reference cannot be NULL"); - Preconditions.checkArgument(relativeXPath != null, "Non Conditional Revision Aware XPath cannot be NULL"); - Preconditions.checkState(!relativeXPath.isAbsolute(), - "Revision Aware XPath MUST be relative i.e. MUST contains ../, " - + "for non relative Revision Aware XPath use findDataSchemaNode method"); - Preconditions.checkState(actualSchemaNode.getPath() != null, + // FIXME: 3.0.0: this should throw NPE, not IAE + checkArgument(context != null, "Schema Context reference cannot be NULL"); + checkArgument(module != null, "Module reference cannot be NULL"); + checkArgument(relativeXPath != null, "Non Conditional Revision Aware XPath cannot be NULL"); + checkState(!relativeXPath.isAbsolute(), "Revision Aware XPath MUST be relative i.e. MUST contains ../, " + + "for non relative Revision Aware XPath use findDataSchemaNode method"); + checkState(actualSchemaNode.getPath() != null, "Schema Path reference for Leafref cannot be NULL"); final Iterable xpaths = SLASH_SPLITTER.split(relativeXPath.toString()); @@ -770,7 +752,7 @@ public final class SchemaContextUtil { } final Optional parentModule = schemaContext.findModule(qname.getModule()); - Preconditions.checkArgument(parentModule.isPresent(), "Failed to find parent module for %s", qname); + checkArgument(parentModule.isPresent(), "Failed to find parent module for %s", qname); final DataSchemaNode dataSchemaNode = (DataSchemaNode) SchemaContextUtil.findDataSchemaNode(schemaContext, parentModule.get(), strippedPathStatement); @@ -784,8 +766,8 @@ public final class SchemaContextUtil { private static Module findParentModuleOfReferencingType(final SchemaContext schemaContext, final SchemaNode schemaNode) { - Preconditions.checkArgument(schemaContext != null, "Schema Context reference cannot be NULL!"); - Preconditions.checkArgument(schemaNode instanceof TypedDataSchemaNode, "Unsupported node %s", schemaNode); + checkArgument(schemaContext != null, "Schema Context reference cannot be NULL!"); + checkArgument(schemaNode instanceof TypedDataSchemaNode, "Unsupported node %s", schemaNode); TypeDefinition nodeType = ((TypedDataSchemaNode) schemaNode).getType(); if (nodeType.getBaseType() != null) { diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaNodeUtils.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaNodeUtils.java index 64ae8da3d7..2b21b23c11 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaNodeUtils.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/SchemaNodeUtils.java @@ -10,8 +10,8 @@ package org.opendaylight.yangtools.yang.model.util; import static java.util.Objects.requireNonNull; import java.util.Optional; -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.common.QName; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DerivableSchemaNode; @@ -19,7 +19,6 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition; import org.opendaylight.yangtools.yang.model.api.SchemaNode; public final class SchemaNodeUtils { - private SchemaNodeUtils() { throw new UnsupportedOperationException("Utility class"); } @@ -50,11 +49,10 @@ public final class SchemaNodeUtils { * @param qname input or output QName with namespace same as RPC * @return input or output schema. Returns null if RPC does not have input/output specified. */ - @Nullable public static ContainerSchemaNode getRpcDataSchema(@Nonnull final RpcDefinition rpc, - @Nonnull final QName qname) { + public static @Nullable ContainerSchemaNode getRpcDataSchema(final @NonNull RpcDefinition rpc, + final @NonNull QName qname) { requireNonNull(rpc, "Rpc Schema must not be null"); - requireNonNull(qname, "QName must not be null"); - switch (qname.getLocalName()) { + switch (requireNonNull(qname, "QName must not be null").getLocalName()) { case "input": return rpc.getInput(); case "output": diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractLengthRestrictedDerivedType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractLengthRestrictedDerivedType.java index e263629f68..27cfaf785f 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractLengthRestrictedDerivedType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractLengthRestrictedDerivedType.java @@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.model.util.type; import java.util.Collection; import java.util.Optional; -import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; @@ -25,7 +24,6 @@ abstract class AbstractLengthRestrictedDerivedType getLengthConstraint() { return baseType().getLengthConstraint(); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedBaseType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedBaseType.java index 868a0f0d98..4d767e6473 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedBaseType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedBaseType.java @@ -13,7 +13,6 @@ import com.google.common.collect.ImmutableRangeSet; import com.google.common.collect.Range; import java.util.List; import java.util.Optional; -import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.model.api.ConstraintMetaDefinition; import org.opendaylight.yangtools.yang.model.api.SchemaPath; @@ -61,7 +60,6 @@ abstract class AbstractRangeRestrictedBaseType> getRangeConstraint() { return Optional.of(rangeConstraint); } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedDerivedType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedDerivedType.java index f0cb11bca3..86674ebd00 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedDerivedType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedDerivedType.java @@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.model.util.type; import java.util.Collection; import java.util.Optional; -import javax.annotation.Nonnull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; @@ -26,7 +25,6 @@ abstract class AbstractRangeRestrictedDerivedType> getRangeConstraint() { return baseType().getRangeConstraint(); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedType.java index fc88af6a8f..dcd460951a 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRangeRestrictedType.java @@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.model.util.type; import java.util.Collection; import java.util.Optional; -import javax.annotation.Nonnull; import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; @@ -28,7 +27,6 @@ abstract class AbstractRangeRestrictedType> getRangeConstraint() { return Optional.ofNullable(rangeConstraint); } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRestrictedTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRestrictedTypeBuilder.java index 32148793e1..cd172c8598 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRestrictedTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/AbstractRestrictedTypeBuilder.java @@ -7,7 +7,9 @@ */ package org.opendaylight.yangtools.yang.model.util.type; -import com.google.common.base.Preconditions; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Verify.verifyNotNull; + import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; @@ -18,7 +20,7 @@ abstract class AbstractRestrictedTypeBuilder> extend AbstractRestrictedTypeBuilder(final T baseType, final SchemaPath path) { super(baseType, path); if (baseType != null) { - Preconditions.checkArgument(baseType instanceof AbstractBaseType || baseType instanceof AbstractDerivedType, + checkArgument(baseType instanceof AbstractBaseType || baseType instanceof AbstractDerivedType, "Restricted type has to be based on either a base or derived type, not %s", baseType); } else { touched = true; @@ -33,10 +35,6 @@ abstract class AbstractRestrictedTypeBuilder> extend @Override public final T build() { - if (!touched) { - return getBaseType(); - } - - return buildType(); + return touched ? buildType() : verifyNotNull(getBaseType()); } } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBinaryType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBinaryType.java index 51f2196706..cf38120e7e 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBinaryType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBinaryType.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseBinaryType extends AbstractLengthRestrictedBaseType implements BinaryTypeDefinition { - static final BaseBinaryType INSTANCE = new BaseBinaryType(); + static final @NonNull BaseBinaryType INSTANCE = new BaseBinaryType(); private BaseBinaryType() { super(BaseTypes.BINARY_QNAME); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBooleanType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBooleanType.java index 904fd7252b..e3961dd204 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBooleanType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseBooleanType.java @@ -7,11 +7,12 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseBooleanType extends AbstractBaseType implements BooleanTypeDefinition { - static final BaseBooleanType INSTANCE = new BaseBooleanType(); + static final @NonNull BaseBooleanType INSTANCE = new BaseBooleanType(); private BaseBooleanType() { super(BaseTypes.BOOLEAN_QNAME); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseEmptyType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseEmptyType.java index 3727e98d18..12fe0ee47f 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseEmptyType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseEmptyType.java @@ -7,11 +7,12 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseEmptyType extends AbstractBaseType implements EmptyTypeDefinition { - static final BaseEmptyType INSTANCE = new BaseEmptyType(); + static final @NonNull BaseEmptyType INSTANCE = new BaseEmptyType(); private BaseEmptyType() { super(BaseTypes.EMPTY_QNAME); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInstanceIdentifierType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInstanceIdentifierType.java index da7fabffb7..10c26002ec 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInstanceIdentifierType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInstanceIdentifierType.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseInstanceIdentifierType extends AbstractBaseType implements InstanceIdentifierTypeDefinition { - static final BaseInstanceIdentifierType INSTANCE = new BaseInstanceIdentifierType(); + static final @NonNull BaseInstanceIdentifierType INSTANCE = new BaseInstanceIdentifierType(); private BaseInstanceIdentifierType() { super(BaseTypes.INSTANCE_IDENTIFIER_QNAME); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt16Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt16Type.java index d4716f2985..af4d06a7d7 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt16Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt16Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Int16TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseInt16Type extends AbstractRangeRestrictedBaseType implements Int16TypeDefinition { - static final BaseInt16Type INSTANCE = new BaseInt16Type(); + static final @NonNull BaseInt16Type INSTANCE = new BaseInt16Type(); private BaseInt16Type() { super(BaseTypes.INT16_QNAME, Short.MIN_VALUE, Short.MAX_VALUE); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt32Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt32Type.java index 25ba84a11e..08935902f6 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt32Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt32Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Int32TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseInt32Type extends AbstractRangeRestrictedBaseType implements Int32TypeDefinition { - static final BaseInt32Type INSTANCE = new BaseInt32Type(); + static final @NonNull BaseInt32Type INSTANCE = new BaseInt32Type(); private BaseInt32Type() { super(BaseTypes.INT32_QNAME, Integer.MIN_VALUE, Integer.MAX_VALUE); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt64Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt64Type.java index 275b2db074..cf8c033516 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt64Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt64Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Int64TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseInt64Type extends AbstractRangeRestrictedBaseType implements Int64TypeDefinition { - static final BaseInt64Type INSTANCE = new BaseInt64Type(); + static final @NonNull BaseInt64Type INSTANCE = new BaseInt64Type(); private BaseInt64Type() { super(BaseTypes.INT64_QNAME, Long.MIN_VALUE, Long.MAX_VALUE); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt8Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt8Type.java index 7aec300e98..bc11699ef4 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt8Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseInt8Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Int8TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseInt8Type extends AbstractRangeRestrictedBaseType implements Int8TypeDefinition { - static final BaseInt8Type INSTANCE = new BaseInt8Type(); + static final @NonNull BaseInt8Type INSTANCE = new BaseInt8Type(); private BaseInt8Type() { super(BaseTypes.INT8_QNAME, Byte.MIN_VALUE, Byte.MAX_VALUE); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseStringType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseStringType.java index 6074fb651d..1cb7cfad74 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseStringType.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseStringType.java @@ -9,13 +9,14 @@ package org.opendaylight.yangtools.yang.model.util.type; import com.google.common.collect.ImmutableList; import java.util.List; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint; import org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseStringType extends AbstractLengthRestrictedBaseType implements StringTypeDefinition { - static final BaseStringType INSTANCE = new BaseStringType(); + static final @NonNull BaseStringType INSTANCE = new BaseStringType(); private BaseStringType() { super(BaseTypes.STRING_QNAME); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java index cb3dc5227e..6deaa150ea 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseTypes.java @@ -8,7 +8,7 @@ package org.opendaylight.yangtools.yang.model.util.type; import com.google.common.annotations.Beta; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition; @@ -59,39 +59,39 @@ public final class BaseTypes { throw new UnsupportedOperationException(); } - public static BinaryTypeDefinition binaryType() { + public static @NonNull BinaryTypeDefinition binaryType() { return BaseBinaryType.INSTANCE; } - public static BitsTypeBuilder bitsTypeBuilder(final SchemaPath path) { + public static @NonNull BitsTypeBuilder bitsTypeBuilder(final SchemaPath path) { return new BitsTypeBuilder(path); } - public static BooleanTypeDefinition booleanType() { + public static @NonNull BooleanTypeDefinition booleanType() { return BaseBooleanType.INSTANCE; } - public static DecimalTypeBuilder decimalTypeBuilder(final SchemaPath path) { + public static @NonNull DecimalTypeBuilder decimalTypeBuilder(final SchemaPath path) { return new DecimalTypeBuilder(path); } - public static EmptyTypeDefinition emptyType() { + public static @NonNull EmptyTypeDefinition emptyType() { return BaseEmptyType.INSTANCE; } - public static EnumerationTypeBuilder enumerationTypeBuilder(final SchemaPath path) { + public static @NonNull EnumerationTypeBuilder enumerationTypeBuilder(final SchemaPath path) { return new EnumerationTypeBuilder(path); } - public static IdentityrefTypeBuilder identityrefTypeBuilder(final SchemaPath path) { + public static @NonNull IdentityrefTypeBuilder identityrefTypeBuilder(final SchemaPath path) { return new IdentityrefTypeBuilder(path); } - public static InstanceIdentifierTypeDefinition instanceIdentifierType() { + public static @NonNull InstanceIdentifierTypeDefinition instanceIdentifierType() { return BaseInstanceIdentifierType.INSTANCE; } - public static Int8TypeDefinition int8Type() { + public static @NonNull Int8TypeDefinition int8Type() { return BaseInt8Type.INSTANCE; } @@ -105,7 +105,7 @@ public final class BaseTypes { return BaseInt8Type.INSTANCE.getPath().equals(type.getPath()); } - public static Int16TypeDefinition int16Type() { + public static @NonNull Int16TypeDefinition int16Type() { return BaseInt16Type.INSTANCE; } @@ -119,7 +119,7 @@ public final class BaseTypes { return BaseInt16Type.INSTANCE.getPath().equals(type.getPath()); } - public static Int32TypeDefinition int32Type() { + public static @NonNull Int32TypeDefinition int32Type() { return BaseInt32Type.INSTANCE; } @@ -134,7 +134,7 @@ public final class BaseTypes { return BaseInt32Type.INSTANCE.getPath().equals(type.getPath()); } - public static Int64TypeDefinition int64Type() { + public static @NonNull Int64TypeDefinition int64Type() { return BaseInt64Type.INSTANCE; } @@ -148,11 +148,11 @@ public final class BaseTypes { return BaseInt64Type.INSTANCE.getPath().equals(type.getPath()); } - public static LeafrefTypeBuilder leafrefTypeBuilder(final SchemaPath path) { + public static @NonNull LeafrefTypeBuilder leafrefTypeBuilder(final SchemaPath path) { return new LeafrefTypeBuilder(path); } - public static StringTypeDefinition stringType() { + public static @NonNull StringTypeDefinition stringType() { return BaseStringType.INSTANCE; } @@ -160,7 +160,7 @@ public final class BaseTypes { return new UnionTypeBuilder(path); } - public static Uint8TypeDefinition uint8Type() { + public static @NonNull Uint8TypeDefinition uint8Type() { return BaseUint8Type.INSTANCE; } @@ -171,11 +171,11 @@ public final class BaseTypes { * @return If the type corresponds to the base uint8 type. * @throws NullPointerException if type is null */ - public static boolean isUint8(@Nonnull final TypeDefinition type) { + public static boolean isUint8(final @NonNull TypeDefinition type) { return BaseUint8Type.INSTANCE.getPath().equals(type.getPath()); } - public static Uint16TypeDefinition uint16Type() { + public static @NonNull Uint16TypeDefinition uint16Type() { return BaseUint16Type.INSTANCE; } @@ -186,11 +186,11 @@ public final class BaseTypes { * @return If the type corresponds to the base uint16 type. * @throws NullPointerException if type is null */ - public static boolean isUint16(@Nonnull final TypeDefinition type) { + public static boolean isUint16(final @NonNull TypeDefinition type) { return BaseUint16Type.INSTANCE.getPath().equals(type.getPath()); } - public static Uint32TypeDefinition uint32Type() { + public static @NonNull Uint32TypeDefinition uint32Type() { return BaseUint32Type.INSTANCE; } @@ -201,11 +201,11 @@ public final class BaseTypes { * @return If the type corresponds to the base uint32 type. * @throws NullPointerException if type is null */ - public static boolean isUint32(@Nonnull final TypeDefinition type) { + public static boolean isUint32(final @NonNull TypeDefinition type) { return BaseUint32Type.INSTANCE.getPath().equals(type.getPath()); } - public static Uint64TypeDefinition uint64Type() { + public static @NonNull Uint64TypeDefinition uint64Type() { return BaseUint64Type.INSTANCE; } @@ -216,7 +216,7 @@ public final class BaseTypes { * @return If the type corresponds to the base uint64 type. * @throws NullPointerException if type is null */ - public static boolean isUint64(@Nonnull final TypeDefinition type) { + public static boolean isUint64(final @NonNull TypeDefinition type) { return BaseUint64Type.INSTANCE.getPath().equals(type.getPath()); } @@ -228,7 +228,7 @@ public final class BaseTypes { * @return Base type of specified type * @throws NullPointerException if type is null */ - public static TypeDefinition baseTypeOf(@Nonnull final TypeDefinition type) { + public static @NonNull TypeDefinition baseTypeOf(final @NonNull TypeDefinition type) { TypeDefinition ret = type; while (ret.getBaseType() != null) { ret = ret.getBaseType(); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint16Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint16Type.java index cc4ec376f4..41b525927d 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint16Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint16Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Uint16TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseUint16Type extends AbstractRangeRestrictedBaseType implements Uint16TypeDefinition { - static final BaseUint16Type INSTANCE = new BaseUint16Type(); + static final @NonNull BaseUint16Type INSTANCE = new BaseUint16Type(); private BaseUint16Type() { super(BaseTypes.UINT16_QNAME, 0, 65535); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint32Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint32Type.java index 97fdeb0974..692e6eb367 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint32Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint32Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Uint32TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseUint32Type extends AbstractRangeRestrictedBaseType implements Uint32TypeDefinition { - static final BaseUint32Type INSTANCE = new BaseUint32Type(); + static final @NonNull BaseUint32Type INSTANCE = new BaseUint32Type(); private BaseUint32Type() { super(BaseTypes.UINT32_QNAME, 0L, 4294967295L); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint64Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint64Type.java index 0c982a6a08..9de402b7c7 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint64Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint64Type.java @@ -8,12 +8,13 @@ package org.opendaylight.yangtools.yang.model.util.type; import java.math.BigInteger; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Uint64TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseUint64Type extends AbstractRangeRestrictedBaseType implements Uint64TypeDefinition { - static final BaseUint64Type INSTANCE = new BaseUint64Type(); + static final @NonNull BaseUint64Type INSTANCE = new BaseUint64Type(); private BaseUint64Type() { super(BaseTypes.UINT64_QNAME, BigInteger.ZERO, new BigInteger("18446744073709551615")); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint8Type.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint8Type.java index b952600bc5..c65293e17a 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint8Type.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BaseUint8Type.java @@ -7,12 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.type.Uint8TypeDefinition; import org.opendaylight.yangtools.yang.model.util.BaseTypes; final class BaseUint8Type extends AbstractRangeRestrictedBaseType implements Uint8TypeDefinition { - static final BaseUint8Type INSTANCE = new BaseUint8Type(); + static final @NonNull BaseUint8Type INSTANCE = new BaseUint8Type(); private BaseUint8Type() { super(BaseTypes.UINT8_QNAME, (short)0, (short)255); diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BitsTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BitsTypeBuilder.java index 5c301bdafd..11e0bedef8 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BitsTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/BitsTypeBuilder.java @@ -11,7 +11,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import java.util.Map; import java.util.TreeMap; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit; @@ -27,7 +27,7 @@ public final class BitsTypeBuilder extends AbstractRestrictedTypeBuilder compatType(@Nonnull final TypedDataSchemaNode leaf) { - final TypeDefinition leafType = leaf.getType(); - Preconditions.checkNotNull(leafType); + public static @NonNull TypeDefinition compatType(final @NonNull TypedDataSchemaNode leaf) { + final TypeDefinition leafType = requireNonNull(leaf.getType()); if (!leaf.getPath().equals(leafType.getPath())) { // Old parser semantics, or no new default/units defined for this leaf @@ -130,7 +131,7 @@ public final class CompatUtils { // We are dealing with a type generated for the leaf itself final TypeDefinition baseType = leafType.getBaseType(); - Preconditions.checkArgument(baseType != null, "Leaf %s has type for leaf, but no base type", leaf); + checkArgument(baseType != null, "Leaf %s has type for leaf, but no base type", leaf); if (leaf.getPath().equals(baseType.getPath().getParent())) { // Internal instantiation of a base YANG type (decimal64 and similar) @@ -170,24 +171,24 @@ public final class CompatUtils { } // FIXME: 3.0.0: remove this method - @Nonnull public static TypeDefinition compatLeafType(@Nonnull final LeafSchemaNode leaf) { + public static @NonNull TypeDefinition compatLeafType(final @NonNull LeafSchemaNode leaf) { return compatType(leaf); } - private static BinaryTypeDefinition baseTypeIfNotConstrained(final BinaryTypeDefinition type) { + private static BinaryTypeDefinition baseTypeIfNotConstrained(final @NonNull BinaryTypeDefinition type) { return baseTypeIfNotConstrained(type, type.getBaseType()); } - private static TypeDefinition baseTypeIfNotConstrained(final DecimalTypeDefinition type) { + private static TypeDefinition baseTypeIfNotConstrained(final @NonNull DecimalTypeDefinition type) { return baseTypeIfNotConstrained(type, type.getBaseType()); } - private static TypeDefinition baseTypeIfNotConstrained(final InstanceIdentifierTypeDefinition type) { + private static TypeDefinition baseTypeIfNotConstrained(final @NonNull InstanceIdentifierTypeDefinition type) { final InstanceIdentifierTypeDefinition base = type.getBaseType(); return type.requireInstance() == base.requireInstance() ? base : type; } - private static TypeDefinition baseTypeIfNotConstrained(final StringTypeDefinition type) { + private static TypeDefinition baseTypeIfNotConstrained(final @NonNull StringTypeDefinition type) { final StringTypeDefinition base = type.getBaseType(); final List patterns = type.getPatternConstraints(); final Optional optLengths = type.getLengthConstraint(); @@ -200,11 +201,11 @@ public final class CompatUtils { return type; } - private static > T baseTypeIfNotConstrained(final T type) { + private static > T baseTypeIfNotConstrained(final @NonNull T type) { return baseTypeIfNotConstrained(type, type.getBaseType()); } - private static > T baseTypeIfNotConstrained(final T type, + private static > T baseTypeIfNotConstrained(final @NonNull T type, final T base) { final Optional optConstraint = type.getRangeConstraint(); if (!optConstraint.isPresent()) { @@ -213,7 +214,7 @@ public final class CompatUtils { return optConstraint.equals(base.getRangeConstraint()) ? base : type; } - private static > T baseTypeIfNotConstrained(final T type, + private static > T baseTypeIfNotConstrained(final @NonNull T type, final T base) { final Optional optConstraint = type.getLengthConstraint(); if (!optConstraint.isPresent()) { diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypeBuilder.java index 06408daf3d..4a9d9ac230 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypeBuilder.java @@ -7,10 +7,11 @@ */ package org.opendaylight.yangtools.yang.model.util.type; +import static com.google.common.base.Verify.verifyNotNull; + import com.google.common.annotations.Beta; -import com.google.common.base.Verify; import java.util.Objects; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; @@ -36,7 +37,7 @@ public abstract class ConcreteTypeBuilder> extends D * * @return A new type instance */ - @Nonnull abstract T buildType(); + abstract @NonNull T buildType(); @Override public final T build() { @@ -46,6 +47,6 @@ public abstract class ConcreteTypeBuilder> extends D return base; } - return Verify.verifyNotNull(buildType()); + return verifyNotNull(buildType()); } } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypes.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypes.java index 1f43830e59..a1fd2cdd1d 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypes.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/ConcreteTypes.java @@ -8,7 +8,7 @@ package org.opendaylight.yangtools.yang.model.util.type; import com.google.common.annotations.Beta; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition; @@ -35,13 +35,13 @@ import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition; * Support for creating {@link TypeDefinition} instances defined by leaf and leaf-list statements. */ @Beta +@NonNullByDefault public final class ConcreteTypes { private ConcreteTypes() { throw new UnsupportedOperationException(); } - public static ConcreteTypeBuilder concreteTypeBuilder(@Nonnull final TypeDefinition baseType, - @Nonnull final SchemaPath path) { + public static ConcreteTypeBuilder concreteTypeBuilder(final TypeDefinition baseType, final SchemaPath path) { if (baseType instanceof BinaryTypeDefinition) { return concreteBinaryBuilder((BinaryTypeDefinition) baseType, path); } else if (baseType instanceof BitsTypeDefinition) { @@ -86,9 +86,8 @@ public final class ConcreteTypes { } private static ConcreteTypeBuilder concreteBinaryBuilder( - @Nonnull final BinaryTypeDefinition baseType, @Nonnull final SchemaPath path) { + final BinaryTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public BinaryTypeDefinition buildType() { return new DerivedBinaryType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -100,7 +99,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteBitsBuilder(final BitsTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public BitsTypeDefinition buildType() { return new DerivedBitsType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -110,9 +108,8 @@ public final class ConcreteTypes { } private static ConcreteTypeBuilder concreteBooleanBuilder( - @Nonnull final BooleanTypeDefinition baseType, @Nonnull final SchemaPath path) { + final BooleanTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public BooleanTypeDefinition buildType() { return new DerivedBooleanType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -124,7 +121,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteDecimalBuilder( final DecimalTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public DecimalTypeDefinition buildType() { return new DerivedDecimalType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -136,7 +132,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteEmptyBuilder(final EmptyTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public EmptyTypeDefinition buildType() { return new DerivedEmptyType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -148,7 +143,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteEnumerationBuilder( final EnumTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public EnumTypeDefinition buildType() { return new DerivedEnumerationType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -160,7 +154,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteIdentityrefBuilder( final IdentityrefTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public IdentityrefTypeDefinition buildType() { return new DerivedIdentityrefType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -172,7 +165,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteInstanceIdentifierBuilder( final InstanceIdentifierTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public InstanceIdentifierTypeDefinition buildType() { return new DerivedInstanceIdentifierType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -184,7 +176,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteInt8Builder( final Int8TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Int8TypeDefinition buildType() { return new DerivedInt8Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -196,7 +187,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteInt16Builder( final Int16TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Int16TypeDefinition buildType() { return new DerivedInt16Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -208,7 +198,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteInt32Builder( final Int32TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Int32TypeDefinition buildType() { return new DerivedInt32Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -220,7 +209,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteInt64Builder( final Int64TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Int64TypeDefinition buildType() { return new DerivedInt64Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -232,7 +220,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteLeafrefBuilder( final LeafrefTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public LeafrefTypeDefinition buildType() { return new DerivedLeafrefType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -244,7 +231,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteStringBuilder(final StringTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public StringTypeDefinition buildType() { return new DerivedStringType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -256,7 +242,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteUnionBuilder(final UnionTypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public DerivedUnionType buildType() { return new DerivedUnionType(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -268,7 +253,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteUint8Builder( final Uint8TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Uint8TypeDefinition buildType() { return new DerivedUint8Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -280,7 +264,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteUint16Builder( final Uint16TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Uint16TypeDefinition buildType() { return new DerivedUint16Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -292,7 +275,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteUint32Builder( final Uint32TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Uint32TypeDefinition buildType() { return new DerivedUint32Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), @@ -304,7 +286,6 @@ public final class ConcreteTypes { private static ConcreteTypeBuilder concreteUint64Builder( final Uint64TypeDefinition baseType, final SchemaPath path) { return new ConcreteTypeBuilder(baseType, path) { - @Nonnull @Override public Uint64TypeDefinition buildType() { return new DerivedUint64Type(getBaseType(), getPath(), getDefaultValue(), getDescription(), diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypeBuilder.java index cd7fffd283..811c6ae316 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypeBuilder.java @@ -11,7 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; import java.util.Optional; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; @@ -45,19 +45,19 @@ public abstract class DerivedTypeBuilder> extends Ty units = baseType.getUnits().orElse(null); } - public void setDefaultValue(@Nonnull final Object defaultValue) { + public void setDefaultValue(final @NonNull Object defaultValue) { this.defaultValue = requireNonNull(defaultValue); } - public final void setDescription(@Nonnull final String description) { + public final void setDescription(final @NonNull String description) { this.description = requireNonNull(description); } - public final void setReference(@Nonnull final String reference) { + public final void setReference(final @NonNull String reference) { this.reference = requireNonNull(reference); } - public final void setStatus(@Nonnull final Status status) { + public final void setStatus(final @NonNull Status status) { this.status = requireNonNull(status); } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java index f38aa37b05..e098c418b8 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/DerivedTypes.java @@ -8,7 +8,7 @@ package org.opendaylight.yangtools.yang.model.util.type; import com.google.common.annotations.Beta; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition; @@ -47,8 +47,8 @@ public final class DerivedTypes { throw new UnsupportedOperationException(); } - public static DerivedTypeBuilder derivedTypeBuilder(@Nonnull final TypeDefinition baseType, - @Nonnull final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedTypeBuilder(final @NonNull TypeDefinition baseType, + final @NonNull SchemaPath path) { if (baseType instanceof BinaryTypeDefinition) { return derivedBinaryBuilder((BinaryTypeDefinition) baseType, path); } else if (baseType instanceof BitsTypeDefinition) { @@ -92,8 +92,8 @@ public final class DerivedTypes { } } - public static DerivedTypeBuilder derivedBinaryBuilder( - @Nonnull final BinaryTypeDefinition baseType, @Nonnull final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedBinaryBuilder( + final @NonNull BinaryTypeDefinition baseType, final @NonNull SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public BinaryTypeDefinition build() { @@ -103,7 +103,7 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedBitsBuilder(final BitsTypeDefinition baseType, + public static @NonNull DerivedTypeBuilder derivedBitsBuilder(final BitsTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -114,8 +114,8 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedBooleanBuilder( - @Nonnull final BooleanTypeDefinition baseType, @Nonnull final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedBooleanBuilder( + final @NonNull BooleanTypeDefinition baseType, final @NonNull SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public BooleanTypeDefinition build() { @@ -125,8 +125,8 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedDecimalBuilder(final DecimalTypeDefinition baseType, - final SchemaPath path) { + private static @NonNull DerivedTypeBuilder derivedDecimalBuilder( + final DecimalTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public DecimalTypeDefinition build() { @@ -136,8 +136,8 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedEmptyBuilder(final EmptyTypeDefinition baseType, - final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedEmptyBuilder( + final EmptyTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public EmptyTypeDefinition build() { @@ -147,8 +147,8 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedEnumerationBuilder(final EnumTypeDefinition baseType, - final SchemaPath path) { + private static @NonNull DerivedTypeBuilder derivedEnumerationBuilder( + final EnumTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public EnumTypeDefinition build() { @@ -158,7 +158,7 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedIdentityrefBuilder( + public static @NonNull DerivedTypeBuilder derivedIdentityrefBuilder( final IdentityrefTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -169,7 +169,7 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedInstanceIdentifierBuilder( + public static @NonNull DerivedTypeBuilder derivedInstanceIdentifierBuilder( final InstanceIdentifierTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -180,7 +180,7 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedInt8Builder(final Int8TypeDefinition baseType, + private static @NonNull DerivedTypeBuilder derivedInt8Builder(final Int8TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -191,8 +191,8 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedInt16Builder(final Int16TypeDefinition baseType, - final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedInt16Builder( + final Int16TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public Int16TypeDefinition build() { @@ -202,8 +202,8 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedInt32Builder(final Int32TypeDefinition baseType, - final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedInt32Builder( + final Int32TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public Int32TypeDefinition build() { @@ -213,8 +213,8 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedInt64Builder(final Int64TypeDefinition baseType, - final SchemaPath path) { + private static @NonNull DerivedTypeBuilder derivedInt64Builder( + final Int64TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public Int64TypeDefinition build() { @@ -224,8 +224,8 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedLeafrefBuilder(final LeafrefTypeDefinition baseType, - final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedLeafrefBuilder( + final LeafrefTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public LeafrefTypeDefinition build() { @@ -235,8 +235,8 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedStringBuilder(final StringTypeDefinition baseType, - final SchemaPath path) { + private static @NonNull DerivedTypeBuilder derivedStringBuilder( + final StringTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public StringTypeDefinition build() { @@ -246,8 +246,8 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedUnionBuilder(final UnionTypeDefinition baseType, - final SchemaPath path) { + public static @NonNull DerivedTypeBuilder derivedUnionBuilder( + final UnionTypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override public DerivedUnionType build() { @@ -257,7 +257,7 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedUint8Builder( + private static @NonNull DerivedTypeBuilder derivedUint8Builder( final Uint8TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -268,7 +268,7 @@ public final class DerivedTypes { }; } - private static DerivedTypeBuilder derivedUint16Builder( + private static @NonNull DerivedTypeBuilder derivedUint16Builder( final Uint16TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -279,7 +279,7 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedUint32Builder( + public static @NonNull DerivedTypeBuilder derivedUint32Builder( final Uint32TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override @@ -290,7 +290,7 @@ public final class DerivedTypes { }; } - public static DerivedTypeBuilder derivedUint64Builder( + public static @NonNull DerivedTypeBuilder derivedUint64Builder( final Uint64TypeDefinition baseType, final SchemaPath path) { return new DerivedTypeBuilder(baseType, path) { @Override diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/EnumerationTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/EnumerationTypeBuilder.java index f8e3e119e9..bb95d6ed66 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/EnumerationTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/EnumerationTypeBuilder.java @@ -11,7 +11,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; import java.util.HashMap; import java.util.Map; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair; @@ -27,10 +27,11 @@ public final class EnumerationTypeBuilder extends AbstractRestrictedTypeBuilder< super(baseType, path); } - public EnumerationTypeBuilder addEnum(@Nonnull final EnumPair item) { + public EnumerationTypeBuilder addEnum(final @NonNull EnumPair item) { // in case we are dealing with a restricted enumeration type, validate if the enum is a subset of its base type - if (getBaseType() != null) { - validateRestrictedEnum(item); + final EnumTypeDefinition base = getBaseType(); + if (base != null) { + validateRestrictedEnum(item, base); } builder.put(item.getName(), item); @@ -38,14 +39,14 @@ public final class EnumerationTypeBuilder extends AbstractRestrictedTypeBuilder< return this; } - private void validateRestrictedEnum(@Nonnull final EnumPair item) { + private static void validateRestrictedEnum(final @NonNull EnumPair item, final @NonNull EnumTypeDefinition base) { boolean isASubsetOfBaseEnums = false; - for (EnumPair baseTypeEnumPair : getBaseType().getValues()) { + for (EnumPair baseTypeEnumPair : base.getValues()) { if (item.getName().equals(baseTypeEnumPair.getName())) { if (item.getValue() != baseTypeEnumPair.getValue()) { throw new InvalidEnumDefinitionException(item, "Value of enum '%s' must be the same as the value" + " of corresponding enum in the base enumeration type %s.", item.getName(), - getBaseType().getQName()); + base.getQName()); } isASubsetOfBaseEnums = true; break; @@ -54,7 +55,7 @@ public final class EnumerationTypeBuilder extends AbstractRestrictedTypeBuilder< if (!isASubsetOfBaseEnums) { throw new InvalidEnumDefinitionException(item, "Enum '%s' is not a subset of its base enumeration type %s.", - item.getName(), getBaseType().getQName()); + item.getName(), base.getQName()); } } @@ -70,10 +71,7 @@ public final class EnumerationTypeBuilder extends AbstractRestrictedTypeBuilder< } } - if (getBaseType() == null) { - return new BaseEnumerationType(getPath(), getUnknownSchemaNodes(), map.values()); - } else { - return new RestrictedEnumerationType(getBaseType(), getPath(), getUnknownSchemaNodes(), map.values()); - } + return getBaseType() == null ? new BaseEnumerationType(getPath(), getUnknownSchemaNodes(), map.values()) + : new RestrictedEnumerationType(getBaseType(), getPath(), getUnknownSchemaNodes(), map.values()); } } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/IdentityrefTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/IdentityrefTypeBuilder.java index d71b30819f..23d63bda4b 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/IdentityrefTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/IdentityrefTypeBuilder.java @@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkState; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet.Builder; import java.util.Set; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition; @@ -24,7 +24,7 @@ public final class IdentityrefTypeBuilder extends TypeBuilder newBinaryBuilder( - @Nonnull final BinaryTypeDefinition baseType, @Nonnull final SchemaPath path) { + public static @NonNull LengthRestrictedTypeBuilder newBinaryBuilder( + final @NonNull BinaryTypeDefinition baseType, final @NonNull SchemaPath path) { return new LengthRestrictedTypeBuilder(baseType, path) { @Override BinaryTypeDefinition buildType(final @Nullable LengthConstraint constraint) { @@ -93,12 +93,13 @@ public final class RestrictedTypes { }; } - public static BitsTypeBuilder newBitsBuilder(final BitsTypeDefinition baseType, final SchemaPath path) { + public static @NonNull BitsTypeBuilder newBitsBuilder(final BitsTypeDefinition baseType, + final SchemaPath path) { return new BitsTypeBuilder(baseType, path); } - public static TypeBuilder newBooleanBuilder(@Nonnull final BooleanTypeDefinition baseType, - @Nonnull final SchemaPath path) { + public static @NonNull TypeBuilder newBooleanBuilder( + final @NonNull BooleanTypeDefinition baseType, final @NonNull SchemaPath path) { return new AbstractRestrictedTypeBuilder(baseType, path) { @Override BooleanTypeDefinition buildType() { @@ -107,7 +108,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newDecima64Builder( + public static @NonNull RangeRestrictedTypeBuilder newDecima64Builder( final DecimalTypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -117,7 +118,7 @@ public final class RestrictedTypes { }; } - public static TypeBuilder newEmptyBuilder(final EmptyTypeDefinition baseType, + public static @NonNull TypeBuilder newEmptyBuilder(final EmptyTypeDefinition baseType, final SchemaPath path) { return new AbstractRestrictedTypeBuilder(baseType, path) { @Override @@ -127,13 +128,13 @@ public final class RestrictedTypes { }; } - public static EnumerationTypeBuilder newEnumerationBuilder(final EnumTypeDefinition baseType, + public static @NonNull EnumerationTypeBuilder newEnumerationBuilder(final EnumTypeDefinition baseType, final SchemaPath path) { return new EnumerationTypeBuilder(baseType, path); } - public static TypeBuilder newIdentityrefBuilder(final IdentityrefTypeDefinition baseType, - final SchemaPath path) { + public static @NonNull TypeBuilder newIdentityrefBuilder( + final IdentityrefTypeDefinition baseType, final SchemaPath path) { return new AbstractRestrictedTypeBuilder(baseType, path) { @Override IdentityrefTypeDefinition buildType() { @@ -142,18 +143,19 @@ public final class RestrictedTypes { }; } - public static InstanceIdentifierTypeBuilder newInstanceIdentifierBuilder( + public static @NonNull InstanceIdentifierTypeBuilder newInstanceIdentifierBuilder( final InstanceIdentifierTypeDefinition baseType, final SchemaPath path) { return new InstanceIdentifierTypeBuilder(baseType, path); } - public static RequireInstanceRestrictedTypeBuilder newLeafrefBuilder( + public static @NonNull RequireInstanceRestrictedTypeBuilder newLeafrefBuilder( final LeafrefTypeDefinition baseType, final SchemaPath path) { return new RequireInstanceRestrictedTypeBuilder(baseType, path) { @Override LeafrefTypeDefinition buildType() { - if (getRequireInstance() == getBaseType().requireInstance()) { - return getBaseType(); + final LeafrefTypeDefinition base = getBaseType(); + if (getRequireInstance() == base.requireInstance()) { + return base; } return new RestrictedLeafrefType(getBaseType(), getPath(), getUnknownSchemaNodes(), getRequireInstance()); @@ -161,7 +163,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newInt8Builder( + public static @NonNull RangeRestrictedTypeBuilder newInt8Builder( final Int8TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -171,7 +173,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newInt16Builder( + public static @NonNull RangeRestrictedTypeBuilder newInt16Builder( final Int16TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -181,7 +183,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newInt32Builder( + public static @NonNull RangeRestrictedTypeBuilder newInt32Builder( final Int32TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -191,7 +193,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newInt64Builder( + public static @NonNull RangeRestrictedTypeBuilder newInt64Builder( final Int64TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -201,11 +203,12 @@ public final class RestrictedTypes { }; } - public static StringTypeBuilder newStringBuilder(final StringTypeDefinition baseType, final SchemaPath path) { + public static @NonNull StringTypeBuilder newStringBuilder(final StringTypeDefinition baseType, + final SchemaPath path) { return new StringTypeBuilder(baseType, path); } - public static TypeBuilder newUnionBuilder(final UnionTypeDefinition baseType, + public static @NonNull TypeBuilder newUnionBuilder(final UnionTypeDefinition baseType, final SchemaPath path) { return new AbstractRestrictedTypeBuilder(baseType, path) { @Override @@ -215,7 +218,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newUint8Builder( + public static @NonNull RangeRestrictedTypeBuilder newUint8Builder( final Uint8TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -225,7 +228,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newUint16Builder( + public static @NonNull RangeRestrictedTypeBuilder newUint16Builder( final Uint16TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -235,7 +238,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newUint32Builder( + public static @NonNull RangeRestrictedTypeBuilder newUint32Builder( final Uint32TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override @@ -245,7 +248,7 @@ public final class RestrictedTypes { }; } - public static RangeRestrictedTypeBuilder newUint64Builder( + public static @NonNull RangeRestrictedTypeBuilder newUint64Builder( final Uint64TypeDefinition baseType, final SchemaPath path) { return new RangeRestrictedTypeBuilderWithBase(baseType, path) { @Override diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/TypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/TypeBuilder.java index 5920a36c07..ef54193ed7 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/TypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/TypeBuilder.java @@ -7,9 +7,12 @@ */ package org.opendaylight.yangtools.yang.model.util.type; -import com.google.common.base.Preconditions; +import static java.util.Objects.requireNonNull; + import com.google.common.collect.ImmutableList; import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; @@ -17,27 +20,27 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; public abstract class TypeBuilder> implements Builder { private final ImmutableList.Builder unknownSchemaNodes = ImmutableList.builder(); - private final SchemaPath path; - private final T baseType; + private final @NonNull SchemaPath path; + private final @Nullable T baseType; - TypeBuilder(final T baseType, final SchemaPath path) { - this.path = Preconditions.checkNotNull(path); + TypeBuilder(final @Nullable T baseType, final SchemaPath path) { + this.path = requireNonNull(path); this.baseType = baseType; } - final T getBaseType() { + final @Nullable T getBaseType() { return baseType; } - final SchemaPath getPath() { + final @NonNull SchemaPath getPath() { return path; } - final List getUnknownSchemaNodes() { + final @NonNull List getUnknownSchemaNodes() { return unknownSchemaNodes.build(); } - public final void addUnknownSchemaNode(final UnknownSchemaNode node) { + public final void addUnknownSchemaNode(final @NonNull UnknownSchemaNode node) { unknownSchemaNodes.add(node); } } diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/UnionTypeBuilder.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/UnionTypeBuilder.java index 4f8440e31a..18923aefc0 100644 --- a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/UnionTypeBuilder.java +++ b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/type/UnionTypeBuilder.java @@ -9,7 +9,7 @@ package org.opendaylight.yangtools.yang.model.util.type; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList.Builder; -import javax.annotation.Nonnull; +import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.TypeDefinition; import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition; @@ -21,7 +21,7 @@ public final class UnionTypeBuilder extends TypeBuilder { super(null, path); } - public UnionTypeBuilder addType(@Nonnull final TypeDefinition type) { + public UnionTypeBuilder addType(final @NonNull TypeDefinition type) { builder.add(type); return this; } diff --git a/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformerTest.java b/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformerTest.java index adb7b5b532..3fd64d131b 100644 --- a/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformerTest.java +++ b/yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/repo/util/SchemaSourceTransformerTest.java @@ -12,7 +12,6 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import java.util.Arrays; import java.util.concurrent.Future; -import javax.annotation.Nonnull; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -142,13 +141,12 @@ public class SchemaSourceTransformerTest { private class Provider extends AbstractSchemaRepository { @Deprecated @Override - public SchemaContextFactory createSchemaContextFactory(@Nonnull final SchemaSourceFilter filter) { + public SchemaContextFactory createSchemaContextFactory(final SchemaSourceFilter filter) { return null; } @Override - public SchemaContextFactory createSchemaContextFactory( - @Nonnull final SchemaContextFactoryConfiguration config) { + public SchemaContextFactory createSchemaContextFactory(final SchemaContextFactoryConfiguration config) { return null; } @@ -157,13 +155,12 @@ public class SchemaSourceTransformerTest { private class Consumer extends AbstractSchemaRepository { @Deprecated @Override - public SchemaContextFactory createSchemaContextFactory(@Nonnull final SchemaSourceFilter filter) { + public SchemaContextFactory createSchemaContextFactory(final SchemaSourceFilter filter) { return null; } @Override - public SchemaContextFactory createSchemaContextFactory( - @Nonnull final SchemaContextFactoryConfiguration config) { + public SchemaContextFactory createSchemaContextFactory(final SchemaContextFactoryConfiguration config) { return null; } } -- 2.36.6