diff options
author | Harald Musum <musum@verizonmedia.com> | 2019-08-29 09:52:43 +0200 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2019-08-29 09:52:43 +0200 |
commit | 408ae127916b740cfff1620afdce0bc12ae632e9 (patch) | |
tree | 565f5dd2a9eaf995115ed66ce3a17d53c274ab18 | |
parent | 640f1272a1800551f10b96321c82e75c41c6e54d (diff) |
Remove use of Nullable and NotNull annotations
Different implementations and using OSGi makes it really
hard to use these annotations and the value of using them
is IMHO not very high.
44 files changed, 44 insertions, 217 deletions
diff --git a/config-application-package/src/main/java/com/yahoo/config/application/Xml.java b/config-application-package/src/main/java/com/yahoo/config/application/Xml.java index 396bf3a0ca2..e28c5eac0bb 100644 --- a/config-application-package/src/main/java/com/yahoo/config/application/Xml.java +++ b/config-application-package/src/main/java/com/yahoo/config/application/Xml.java @@ -6,7 +6,6 @@ import com.yahoo.io.reader.NamedReader; import com.yahoo.log.LogLevel; import com.yahoo.path.Path; import com.yahoo.text.XML; -import edu.umd.cs.findbugs.annotations.NonNull; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; @@ -115,7 +114,6 @@ public class Xml { /** * @return The root element of each xml file under pathFromAppRoot/ in the app package */ - @NonNull public static List<Element> allElemsFromPath(ApplicationPackage app, String pathFromAppRoot) { List<Element> ret = new ArrayList<>(); List<NamedReader> files = null; diff --git a/config-lib/src/main/java/com/yahoo/config/BooleanNode.java b/config-lib/src/main/java/com/yahoo/config/BooleanNode.java index 3674f98a2b6..34b3b13fba0 100644 --- a/config-lib/src/main/java/com/yahoo/config/BooleanNode.java +++ b/config-lib/src/main/java/com/yahoo/config/BooleanNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * The BooleanNode class represents a boolean in a configuration tree. */ @@ -30,7 +28,7 @@ public class BooleanNode extends LeafNode<Boolean> { } @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { if (! value.equalsIgnoreCase("false") && ! value.equalsIgnoreCase("true")) { return false; } diff --git a/config-lib/src/main/java/com/yahoo/config/DoubleNode.java b/config-lib/src/main/java/com/yahoo/config/DoubleNode.java index 0b0562565a2..7e1f75e29dd 100644 --- a/config-lib/src/main/java/com/yahoo/config/DoubleNode.java +++ b/config-lib/src/main/java/com/yahoo/config/DoubleNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * The DoubleNode class represents a double in a configuration tree. */ @@ -30,7 +28,7 @@ public class DoubleNode extends LeafNode<Double> { } @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { try { this.value = Double.parseDouble(value); return true; diff --git a/config-lib/src/main/java/com/yahoo/config/FileNode.java b/config-lib/src/main/java/com/yahoo/config/FileNode.java index f4846ad3c87..3e0355e3cb4 100644 --- a/config-lib/src/main/java/com/yahoo/config/FileNode.java +++ b/config-lib/src/main/java/com/yahoo/config/FileNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Represents a 'file' in a {@link ConfigInstance}, usually a filename. * @@ -33,7 +31,7 @@ public class FileNode extends LeafNode<FileReference> { } @Override - protected boolean doSetValue(@NonNull String stringVal) { + protected boolean doSetValue(String stringVal) { value = new FileReference(ReferenceNode.stripQuotes(stringVal)); return true; } diff --git a/config-lib/src/main/java/com/yahoo/config/IntegerNode.java b/config-lib/src/main/java/com/yahoo/config/IntegerNode.java index e027eaf74a4..e19429b2ae6 100644 --- a/config-lib/src/main/java/com/yahoo/config/IntegerNode.java +++ b/config-lib/src/main/java/com/yahoo/config/IntegerNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * The IntegerNode class represents an integer in a configuration tree. */ @@ -31,7 +29,7 @@ public class IntegerNode extends LeafNode<Integer> { } @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { try { this.value = Integer.parseInt(value); return true; diff --git a/config-lib/src/main/java/com/yahoo/config/LeafNode.java b/config-lib/src/main/java/com/yahoo/config/LeafNode.java index 15575590314..81b2230006e 100644 --- a/config-lib/src/main/java/com/yahoo/config/LeafNode.java +++ b/config-lib/src/main/java/com/yahoo/config/LeafNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Superclass for all leaf nodes in a {@link ConfigInstance}. * <p> @@ -66,7 +64,7 @@ public abstract class LeafNode<T> extends Node implements Cloneable { } // TODO: should throw exception instead of return false. - protected abstract boolean doSetValue(@NonNull String value); + protected abstract boolean doSetValue(String value); /** * This method is meant for internal use in the configuration diff --git a/config-lib/src/main/java/com/yahoo/config/LongNode.java b/config-lib/src/main/java/com/yahoo/config/LongNode.java index c1487fa23a2..8a569be234f 100755 --- a/config-lib/src/main/java/com/yahoo/config/LongNode.java +++ b/config-lib/src/main/java/com/yahoo/config/LongNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Represents a long in a configuration tree. * @author gjoranv @@ -32,7 +30,7 @@ public class LongNode extends LeafNode<Long> { } @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { try { this.value = Long.parseLong(value); return true; diff --git a/config-lib/src/main/java/com/yahoo/config/PathNode.java b/config-lib/src/main/java/com/yahoo/config/PathNode.java index 9d73b5e23c2..17643758009 100644 --- a/config-lib/src/main/java/com/yahoo/config/PathNode.java +++ b/config-lib/src/main/java/com/yahoo/config/PathNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.io.File; import java.nio.file.Path; import java.util.ArrayList; @@ -44,7 +42,7 @@ public class PathNode extends LeafNode<Path> { } @Override - protected boolean doSetValue(@NonNull String stringVal) { + protected boolean doSetValue(String stringVal) { throw new UnsupportedOperationException("doSetValue should not be necessary since the library anymore!"); } diff --git a/config-lib/src/main/java/com/yahoo/config/ReferenceNode.java b/config-lib/src/main/java/com/yahoo/config/ReferenceNode.java index 14146156865..8e9926db5c4 100644 --- a/config-lib/src/main/java/com/yahoo/config/ReferenceNode.java +++ b/config-lib/src/main/java/com/yahoo/config/ReferenceNode.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * A ReferenceNode class represents a reference (that is a config-id) * in a {@link ConfigInstance}. @@ -44,7 +42,7 @@ public class ReferenceNode extends LeafNode<String> { } @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { this.value = stripQuotes(value); return true; } diff --git a/config-lib/src/main/java/com/yahoo/config/StringNode.java b/config-lib/src/main/java/com/yahoo/config/StringNode.java index 50c16714f97..cd26fa3d63b 100644 --- a/config-lib/src/main/java/com/yahoo/config/StringNode.java +++ b/config-lib/src/main/java/com/yahoo/config/StringNode.java @@ -2,7 +2,6 @@ package com.yahoo.config; import com.yahoo.config.text.StringUtilities; -import edu.umd.cs.findbugs.annotations.NonNull; /** * A StringNode class represents a string in a {@link ConfigInstance}. @@ -110,7 +109,7 @@ public class StringNode extends LeafNode<String> { * @param value the new value of this node. */ @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { if (value.startsWith("\"") && value.endsWith("\"")) this.value = unescapeQuotedString(value); else { diff --git a/config-lib/src/main/java/com/yahoo/config/UrlNode.java b/config-lib/src/main/java/com/yahoo/config/UrlNode.java index 0ed70ce0f50..9726a62a739 100644 --- a/config-lib/src/main/java/com/yahoo/config/UrlNode.java +++ b/config-lib/src/main/java/com/yahoo/config/UrlNode.java @@ -1,8 +1,6 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.io.File; import java.util.List; import java.util.Map; @@ -45,7 +43,7 @@ public class UrlNode extends LeafNode<File> { } @Override - protected boolean doSetValue(@NonNull String value) { + protected boolean doSetValue(String value) { throw new UnsupportedOperationException("doSetValue should not be necessary since the library anymore!"); } diff --git a/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java b/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java index 5feb5bc3b4f..65934e1cff3 100644 --- a/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java +++ b/config-lib/src/test/java/com/yahoo/config/EnumNodeTest.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config; -import edu.umd.cs.findbugs.annotations.NonNull; import org.junit.Test; import static org.hamcrest.CoreMatchers.is; @@ -9,7 +8,6 @@ import static org.junit.Assert.*; /** * @author Ulf Lilleengen - * @since 5.1 */ public class EnumNodeTest { private static class MyNode extends EnumNode<MyNode.Enum> { @@ -18,7 +16,7 @@ public class EnumNodeTest { public final static Enum TWO = Enum.TWO; @Override - protected boolean doSetValue(@NonNull String name) { + protected boolean doSetValue(String name) { try { value = Enum.valueOf(name); return true; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java b/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java index 6da8df60161..aa59f9434f0 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java @@ -7,7 +7,6 @@ import com.yahoo.config.model.api.HostInfo; import com.yahoo.config.provision.ClusterMembership; import com.yahoo.config.provision.Flavor; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -117,7 +116,7 @@ public class HostResource implements Comparable<HostResource> { /** Returns the flavor of this resource. Empty for self-hosted Vespa. */ public Optional<Flavor> getFlavor() { return flavor; } - public void addClusterMembership(@Nullable ClusterMembership clusterMembership) { + public void addClusterMembership(ClusterMembership clusterMembership) { if (clusterMembership != null) clusterMemberships.add(clusterMembership); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java index b2ab7e19f85..4ff577ab670 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/ConsumersConfigGenerator.java @@ -9,7 +9,6 @@ import com.yahoo.vespa.model.admin.monitoring.Metric; import com.yahoo.vespa.model.admin.monitoring.MetricSet; import com.yahoo.vespa.model.admin.monitoring.MetricsConsumer; -import javax.annotation.Nullable; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -62,7 +61,7 @@ class ConsumersConfigGenerator { new MetricSet(original.getMetricSet().getId(), combinedMetrics.values())); } - private static Metric combineMetrics(@Nullable Metric original, Metric newMetric) { + private static Metric combineMetrics(Metric original, Metric newMetric) { return original != null ? newMetric.addDimensionsFrom(original) : newMetric; } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index 2b9cd18d64b..54318c0b7ea 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -23,7 +23,6 @@ import com.yahoo.vespa.model.container.component.Servlet; import com.yahoo.vespa.model.container.jersey.Jersey2Servlet; import com.yahoo.vespa.model.container.jersey.RestApi; import com.yahoo.vespa.model.utils.FileSender; -import edu.umd.cs.findbugs.annotations.NonNull; import java.nio.file.Paths; import java.util.ArrayList; @@ -112,7 +111,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat this.modelEvaluation = modelEvaluation; } - public final void addRestApi(@NonNull RestApi restApi) { + public final void addRestApi(RestApi restApi) { restApiGroup.addComponent(ComponentId.fromString(restApi.getBindingPath()), restApi); } @@ -125,7 +124,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat return servletGroup.getComponentMap(); } - public final void addServlet(@NonNull Servlet servlet) { + public final void addServlet(Servlet servlet) { servletGroup.addComponent(servlet.getGlobalComponentId(), servlet); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java index 803b06e1e2b..15caebb19cc 100755 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java @@ -56,8 +56,6 @@ import com.yahoo.vespa.model.container.search.ContainerSearch; import com.yahoo.vespa.model.container.search.searchchain.SearchChains; import com.yahoo.vespa.model.content.Content; import com.yahoo.vespa.model.search.AbstractSearchCluster; -import edu.umd.cs.findbugs.annotations.NonNull; -import edu.umd.cs.findbugs.annotations.Nullable; import java.nio.file.Path; import java.util.ArrayList; @@ -330,7 +328,6 @@ public abstract class ContainerCluster<CONTAINER extends Container> return processingChains; } - @NonNull public SearchChains getSearchChains() { if (containerSearch == null) throw new IllegalStateException("Search components not found in container cluster '" + getSubId() + @@ -338,7 +335,6 @@ public abstract class ContainerCluster<CONTAINER extends Container> return containerSearch.getChains(); } - @Nullable public ContainerSearch getSearch() { return containerSearch; } @@ -352,12 +348,10 @@ public abstract class ContainerCluster<CONTAINER extends Container> addChild(http); } - @Nullable public Http getHttp() { return http; } - @Nullable public ContainerDocproc getDocproc() { return containerDocproc; } @@ -366,7 +360,6 @@ public abstract class ContainerCluster<CONTAINER extends Container> this.containerDocproc = containerDocproc; } - @Nullable public ContainerDocumentApi getDocumentApi() { return containerDocumentApi; } @@ -375,7 +368,6 @@ public abstract class ContainerCluster<CONTAINER extends Container> this.containerDocumentApi = containerDocumentApi; } - @NonNull public DocprocChains getDocprocChains() { if (containerDocproc == null) throw new IllegalStateException("Document processing components not found in container cluster '" + getSubId() + diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/component/ContainerSubsystem.java b/config-model/src/main/java/com/yahoo/vespa/model/container/component/ContainerSubsystem.java index 3fa4db60195..0123ea9cf51 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/component/ContainerSubsystem.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/component/ContainerSubsystem.java @@ -2,14 +2,12 @@ package com.yahoo.vespa.model.container.component; import com.yahoo.vespa.model.container.component.chain.Chains; -import edu.umd.cs.findbugs.annotations.NonNull; /** * Holder for components and options related to either processing/search/docproc * for a container cluster. * * @author gjoranv - * @since 5.1.9 */ public abstract class ContainerSubsystem<CHAINS extends Chains<?>> { @@ -19,7 +17,6 @@ public abstract class ContainerSubsystem<CHAINS extends Chains<?>> { this.chains = chains; } - @NonNull public CHAINS getChains() { if (chains == null) throw new IllegalStateException("Null chains for " + this); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/docproc/ContainerDocproc.java b/config-model/src/main/java/com/yahoo/vespa/model/container/docproc/ContainerDocproc.java index 5a251194d75..d4b4dcea78e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/docproc/ContainerDocproc.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/docproc/ContainerDocproc.java @@ -9,7 +9,6 @@ import com.yahoo.container.jdisc.config.SessionConfig; import com.yahoo.docproc.jdisc.messagebus.MbusRequestContext; import com.yahoo.vespa.model.container.ContainerCluster; import com.yahoo.vespa.model.container.component.ContainerSubsystem; -import edu.umd.cs.findbugs.annotations.Nullable; import java.util.HashMap; import java.util.Map; @@ -89,12 +88,10 @@ public class ContainerDocproc extends ContainerSubsystem<DocprocChains> //intentionally high, getMaxQueueMbSize() will probably kick in before this one! } - @Nullable private Integer getMaxQueueMbSize() { return options.maxQueueMbSize; } - private Integer getMaxQueueTimeMs() { return options.maxQueueTimeMs; } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/jersey/RestApiContext.java b/config-model/src/main/java/com/yahoo/vespa/model/container/jersey/RestApiContext.java index 9c424431fc5..390539b643a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/jersey/RestApiContext.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/jersey/RestApiContext.java @@ -10,7 +10,6 @@ import com.yahoo.osgi.provider.model.ComponentModel; import com.yahoo.vespa.model.container.ApplicationContainerCluster; import com.yahoo.vespa.model.container.component.Component; import com.yahoo.vespa.model.container.component.SimpleComponent; -import edu.umd.cs.findbugs.annotations.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -37,7 +36,6 @@ public class RestApiContext extends SimpleComponent implements private final String bindingPath; - @Nullable private ApplicationContainerCluster containerCluster; public RestApiContext(AbstractConfigProducer<?> ancestor, String bindingPath) { diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java b/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java index a1d069da284..55cb05ec230 100755 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java @@ -3,8 +3,6 @@ package com.yahoo.vespa.config; import com.yahoo.config.ConfigInstance; import com.yahoo.config.ConfigurationRuntimeException; -import edu.umd.cs.findbugs.annotations.NonNull; -import edu.umd.cs.findbugs.annotations.Nullable; /** * Class for holding the key when doing cache look-ups and other management of config instances. @@ -13,11 +11,8 @@ import edu.umd.cs.findbugs.annotations.Nullable; */ public class ConfigKey<CONFIGCLASS extends ConfigInstance> implements Comparable<ConfigKey<?>> { - @NonNull private final String name; - @NonNull private final String configId; - @NonNull private final String namespace; // The two fields below are only set when ConfigKey is constructed from a config class. Can be null @@ -97,27 +92,22 @@ public class ConfigKey<CONFIGCLASS extends ConfigInstance> implements Comparable return hash; } - @NonNull public String getName() { return name; } - @NonNull public String getConfigId() { return configId; } - @NonNull public String getNamespace() { return namespace; } - @Nullable public Class<CONFIGCLASS> getConfigClass() { return configClass; } - @Nullable public String getMd5() { return md5; } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java index 6ba788aced3..33914face61 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java @@ -5,8 +5,6 @@ import java.util.Collections; import java.util.Optional; import java.util.Set; -import javax.annotation.Nullable; - import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.yahoo.collections.Tuple2; @@ -154,7 +152,7 @@ public class HttpConfigRequest implements GetConfigRequest, TenantRequest { private static boolean configNameNotFound(final ConfigKey<?> requestKey, Set<ConfigKey<?>> allConfigsProduced) { return !Iterables.any(allConfigsProduced, new Predicate<ConfigKey<?>>() { @Override - public boolean apply(@Nullable ConfigKey<?> k) { + public boolean apply(ConfigKey<?> k) { return k.getName().equals(requestKey.getName()) && k.getNamespace().equals(requestKey.getNamespace()); } }); diff --git a/configserver/src/main/java/com/yahoo/vespa/serviceview/Cluster.java b/configserver/src/main/java/com/yahoo/vespa/serviceview/Cluster.java index 3b39a85c6b1..3251ba6c382 100644 --- a/configserver/src/main/java/com/yahoo/vespa/serviceview/Cluster.java +++ b/configserver/src/main/java/com/yahoo/vespa/serviceview/Cluster.java @@ -6,22 +6,18 @@ import java.util.List; import com.google.common.collect.ImmutableList; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Model a single cluster of services in the Vespa model. * * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> */ public final class Cluster implements Comparable<Cluster> { - @NonNull + public final String name; - @NonNull public final String type; /** * An ordered list of the service instances in this cluster. */ - @NonNull public final ImmutableList<Service> services; public Cluster(String name, String type, List<Service> services) { diff --git a/configserver/src/main/java/com/yahoo/vespa/serviceview/Service.java b/configserver/src/main/java/com/yahoo/vespa/serviceview/Service.java index b5d18bdbb1f..16a65b965e2 100644 --- a/configserver/src/main/java/com/yahoo/vespa/serviceview/Service.java +++ b/configserver/src/main/java/com/yahoo/vespa/serviceview/Service.java @@ -10,24 +10,18 @@ import java.util.List; import com.google.common.collect.ImmutableList; import com.yahoo.text.Utf8; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Model a single service instance as a sortable object. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ public final class Service implements Comparable<Service> { - @NonNull + public final String serviceType; - @NonNull public final String host; public final int statePort; - @NonNull public final String configId; - @NonNull public final List<Integer> ports; - @NonNull public final String name; public Service(String serviceType, String host, int statePort, String clusterName, String clusterType, diff --git a/configserver/src/main/java/com/yahoo/vespa/serviceview/ServiceModel.java b/configserver/src/main/java/com/yahoo/vespa/serviceview/ServiceModel.java index c9574ffaa7e..a155090b79c 100644 --- a/configserver/src/main/java/com/yahoo/vespa/serviceview/ServiceModel.java +++ b/configserver/src/main/java/com/yahoo/vespa/serviceview/ServiceModel.java @@ -19,8 +19,6 @@ import com.yahoo.vespa.serviceview.bindings.ModelResponse; import com.yahoo.vespa.serviceview.bindings.ServicePort; import com.yahoo.vespa.serviceview.bindings.ServiceView; -import edu.umd.cs.findbugs.annotations.NonNull; - import static com.yahoo.config.model.api.container.ContainerServiceType.CLUSTERCONTROLLER_CONTAINER; /** @@ -37,7 +35,6 @@ public final class ServiceModel { /** * An ordered list of the clusters in this config model. */ - @NonNull public final ImmutableList<Cluster> clusters; ServiceModel(ModelResponse modelConfig) { @@ -155,7 +152,7 @@ public final class ServiceModel { } } - private Service getFirstServiceInstanceByType(@NonNull String typeName) { + private Service getFirstServiceInstanceByType(String typeName) { for (Cluster c : clusters) { for (Service s : c.services) { if (typeName.equals(s.serviceType)) { diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java index 0c8ebd70b5e..6d3ae440152 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java @@ -23,7 +23,6 @@ import com.yahoo.search.grouping.request.GroupingOperation; import com.yahoo.search.query.Ranking; import com.yahoo.search.result.ErrorMessage; import com.yahoo.search.searchchain.Execution; -import edu.umd.cs.findbugs.annotations.NonNull; import java.io.IOException; import java.util.Optional; @@ -262,7 +261,7 @@ public class FastSearcher extends VespaBackEndSearcher { return Optional.of(local); } - private static @NonNull Optional<String> quotedSummaryClass(String summaryClass) { + private static Optional<String> quotedSummaryClass(String summaryClass) { return Optional.of(summaryClass == null ? "[null]" : quote(summaryClass)); } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/AndSegmentItem.java b/container-search/src/main/java/com/yahoo/prelude/query/AndSegmentItem.java index 91378eeca21..bac227ac3e3 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/AndSegmentItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/AndSegmentItem.java @@ -3,8 +3,6 @@ package com.yahoo.prelude.query; import java.util.Iterator; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * An immutable and'ing of a collection of sub-expressions. It does not extend * AndItem to avoid code using instanceof handling it as an AndItem. @@ -41,7 +39,6 @@ public class AndSegmentItem extends SegmentItem implements BlockItem { return "SAND"; } - @NonNull public String getIndexName() { if (getItemCount() == 0) { return ""; diff --git a/container-search/src/main/java/com/yahoo/prelude/query/CompositeIndexedItem.java b/container-search/src/main/java/com/yahoo/prelude/query/CompositeIndexedItem.java index 3e53fc64a13..d3a9bb28519 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/CompositeIndexedItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/CompositeIndexedItem.java @@ -3,8 +3,6 @@ package com.yahoo.prelude.query; import com.yahoo.prelude.query.textualrepresentation.Discloser; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.nio.ByteBuffer; /** @@ -22,13 +20,11 @@ import java.nio.ByteBuffer; */ public abstract class CompositeIndexedItem extends CompositeTaggableItem implements IndexedItem { - @NonNull private String index = ""; /** * The name of the index this belongs to, or "" (never null) if not specified **/ - @NonNull public String getIndexName() { return index; } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/HasIndexItem.java b/container-search/src/main/java/com/yahoo/prelude/query/HasIndexItem.java index 8a91587daa2..6641dee9780 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/HasIndexItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/HasIndexItem.java @@ -1,21 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.prelude.query; -import edu.umd.cs.findbugs.annotations.NonNull; - - /** * An interface for items where it is useful to access an associated * index name. * - * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a> + * @author Steinar Knutsen */ public interface HasIndexItem { - @NonNull - public String getIndexName(); + String getIndexName(); /** @return how many phrase words does this item contain */ - public int getNumWords(); + int getNumWords(); } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/IndexedSegmentItem.java b/container-search/src/main/java/com/yahoo/prelude/query/IndexedSegmentItem.java index b459f0aa902..a06009e642a 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/IndexedSegmentItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/IndexedSegmentItem.java @@ -3,8 +3,6 @@ package com.yahoo.prelude.query; import com.yahoo.prelude.query.textualrepresentation.Discloser; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.nio.ByteBuffer; /** @@ -22,7 +20,6 @@ import java.nio.ByteBuffer; */ public abstract class IndexedSegmentItem extends TaggableSegmentItem implements IndexedItem { - @NonNull private String index = ""; protected IndexedSegmentItem(String rawWord, String current, boolean isFromQuery, boolean stemmed, Substring origin) { @@ -32,7 +29,6 @@ public abstract class IndexedSegmentItem extends TaggableSegmentItem implements /** * The name of the index this belongs to, or "" (never null) if not specified **/ - @NonNull public String getIndexName() { return index; } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/SimpleIndexedItem.java b/container-search/src/main/java/com/yahoo/prelude/query/SimpleIndexedItem.java index a8dc9db1928..5d5976e2383 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/SimpleIndexedItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/SimpleIndexedItem.java @@ -3,8 +3,6 @@ package com.yahoo.prelude.query; import com.yahoo.prelude.query.textualrepresentation.Discloser; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.nio.ByteBuffer; /** @@ -22,11 +20,9 @@ import java.nio.ByteBuffer; */ public abstract class SimpleIndexedItem extends SimpleTaggableItem implements IndexedItem { - @NonNull private String index = ""; /** The name of the index this belongs to, or "" (never null) if not specified */ - @NonNull public String getIndexName() { return index; } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java index 902fefae9be..033986dc90f 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/WeakAndItem.java @@ -4,8 +4,6 @@ package com.yahoo.prelude.query; import com.yahoo.compress.IntegerCompressor; import com.yahoo.prelude.query.textualrepresentation.Discloser; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.nio.ByteBuffer; /** @@ -21,7 +19,6 @@ import java.nio.ByteBuffer; public final class WeakAndItem extends NonReducibleCompositeItem { private int N; - @NonNull private String index; private int scoreThreshold = 0; @@ -56,7 +53,6 @@ public final class WeakAndItem extends NonReducibleCompositeItem { this.index = toSet; } - @NonNull public String getIndexName() { return index; } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java index b87de5f019a..0e74099174f 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java @@ -5,8 +5,6 @@ import com.yahoo.collections.CopyOnWriteHashMap; import com.yahoo.compress.IntegerCompressor; import com.yahoo.prelude.query.textualrepresentation.Discloser; -import edu.umd.cs.findbugs.annotations.NonNull; - import java.nio.ByteBuffer; import java.util.Iterator; import java.util.Map; @@ -27,7 +25,6 @@ import java.util.Map; */ public class WeightedSetItem extends SimpleTaggableItem { - @NonNull private String indexName = ""; private CopyOnWriteHashMap<Object,Integer> set = new CopyOnWriteHashMap<>(1000); @@ -99,7 +96,6 @@ public class WeightedSetItem extends SimpleTaggableItem { } } - @NonNull public String getIndexName() { return indexName; } diff --git a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java index 84db07d20da..eef4cb72e9b 100644 --- a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java +++ b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java @@ -35,7 +35,6 @@ import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.search.config.IndexInfoConfig; -import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.query.profile.compiled.CompiledQueryProfile; import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry; import com.yahoo.search.query.profile.config.QueryProfileConfigurer; @@ -50,7 +49,7 @@ import com.yahoo.statistics.Handle; import com.yahoo.statistics.Statistics; import com.yahoo.statistics.Value; import com.yahoo.vespa.configdefinition.SpecialtokensConfig; -import edu.umd.cs.findbugs.annotations.NonNull; + import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.HashMap; @@ -308,7 +307,6 @@ public class SearchHandler extends LoggingRequestHandler { return result.hits().getErrorHit() == null ? 0 : 1; } - @NonNull private Renderer<Result> toRendererCopy(ComponentSpecification format) { Renderer<Result> renderer = executionFactory.rendererRegistry().getRenderer(format); renderer = perRenderingCopy(renderer); @@ -374,7 +372,6 @@ public class SearchHandler extends LoggingRequestHandler { return perRenderingCopy(renderer); } - @NonNull private Renderer<Result> perRenderingCopy(Renderer<Result> renderer) { Renderer<Result> copy = renderer.clone(); copy.init(); diff --git a/container-search/src/main/java/com/yahoo/search/query/Presentation.java b/container-search/src/main/java/com/yahoo/search/query/Presentation.java index 6edef386d49..13196488e98 100644 --- a/container-search/src/main/java/com/yahoo/search/query/Presentation.java +++ b/container-search/src/main/java/com/yahoo/search/query/Presentation.java @@ -10,14 +10,11 @@ import com.yahoo.search.Query; import com.yahoo.search.query.profile.types.FieldDescription; import com.yahoo.search.query.profile.types.QueryProfileType; import com.yahoo.search.rendering.RendererRegistry; -import edu.umd.cs.findbugs.annotations.NonNull; -import edu.umd.cs.findbugs.annotations.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Set; - /** * Parameters deciding how the result of a query should be presented * @@ -69,7 +66,6 @@ public class Presentation implements Cloneable { private boolean timing = false; /** Set of explicitly requested summary fields, instead of summary classes */ - @NonNull private Set<String> summaryFields = LazySet.newHashSet(); private static final Splitter COMMA_SPLITTER = Splitter.on(',').omitEmptyStrings().trimResults(); @@ -95,24 +91,22 @@ public class Presentation implements Cloneable { public void setBolding(boolean bolding) { this.bolding = bolding; } /** Get the name of the format desired for result rendering. */ - @NonNull public ComponentSpecification getRenderer() { return format; } /** Set the desired format for result rendering. If null, use the default renderer. */ - public void setRenderer(@Nullable ComponentSpecification format) { + public void setRenderer(ComponentSpecification format) { this.format = (format != null) ? format : RendererRegistry.defaultRendererId.toSpecification(); } /** * Get the name of the format desired for result rendering. */ - @NonNull public String getFormat() { return format.getName(); } /** * Set the desired format for result rendering. If null, use the default renderer. */ - public void setFormat(@Nullable String format) { + public void setFormat(String format) { setRenderer(ComponentSpecification.fromString(format)); } @@ -168,7 +162,6 @@ public class Presentation implements Cloneable { * * @return the set of names of requested fields, never null */ - @NonNull public Set<String> getSummaryFields() { return summaryFields; } diff --git a/container-search/src/main/java/com/yahoo/search/query/SelectParser.java b/container-search/src/main/java/com/yahoo/search/query/SelectParser.java index ae1d82ef0fb..7540f06266c 100644 --- a/container-search/src/main/java/com/yahoo/search/query/SelectParser.java +++ b/container-search/src/main/java/com/yahoo/search/query/SelectParser.java @@ -46,7 +46,6 @@ import com.yahoo.slime.ArrayTraverser; import com.yahoo.slime.Inspector; import com.yahoo.slime.ObjectTraverser; import com.yahoo.vespa.config.SlimeUtils; -import edu.umd.cs.findbugs.annotations.NonNull; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; @@ -225,7 +224,6 @@ public class SelectParser implements Parser { return operations; } - @NonNull private Item buildFunctionCall(String key, Inspector value) { switch (key) { case WAND: @@ -358,7 +356,6 @@ public class SelectParser implements Parser { return annotations.get(annotationName); } - @NonNull private CompositeItem buildAnd(String key, Inspector value) { AndItem andItem = new AndItem(); addItemsFromInspector(andItem, value); @@ -366,7 +363,6 @@ public class SelectParser implements Parser { return andItem; } - @NonNull private CompositeItem buildNotAnd(String key, Inspector value) { NotItem notItem = new NotItem(); addItemsFromInspector(notItem, value); @@ -374,14 +370,12 @@ public class SelectParser implements Parser { return notItem; } - @NonNull private CompositeItem buildOr(String key, Inspector value) { OrItem orItem = new OrItem(); addItemsFromInspector(orItem, value); return orItem; } - @NonNull private CompositeItem buildWeakAnd(String key, Inspector value) { WeakAndItem weakAnd = new WeakAndItem(); addItemsFromInspector(weakAnd, value); @@ -401,8 +395,7 @@ public class SelectParser implements Parser { return weakAnd; } - @NonNull - private <T extends TaggableItem> T leafStyleSettings(Inspector annotations, @NonNull T out) { + private <T extends TaggableItem> T leafStyleSettings(Inspector annotations, T out) { { if (annotations != null) { Inspector itemConnectivity= getAnnotationAsInspectorOrNull(CONNECTIVITY, getAnnotationMapFromAnnotationInspector(annotations)); @@ -597,29 +590,23 @@ public class SelectParser implements Parser { return leafStyleSettings(annotations, range); } - @NonNull private IntItem buildGreaterThanOrEquals(String field, String bound) { return new IntItem("[" + bound + ";]", field); } - @NonNull private IntItem buildLessThanOrEquals(String field, String bound) { return new IntItem("[;" + bound + "]", field); } - @NonNull private IntItem buildGreaterThan(String field, String bound) { return new IntItem(">" + bound, field); - } - @NonNull private IntItem buildLessThan(String field, String bound) { return new IntItem("<" + bound, field); } - @NonNull private IntItem instantiateRangeItem(Number lowerBound, Number upperBound, String field, boolean bounds_left_open, boolean bounds_right_open) { Preconditions.checkArgument(lowerBound != null && upperBound != null && field != null, "Expected 3 NonNull-arguments"); @@ -665,7 +652,7 @@ public class SelectParser implements Parser { return fillWeightedSet(value, children, out); } - private WeightedSetItem fillWeightedSet(Inspector value, HashMap<Integer, Inspector> children, @NonNull WeightedSetItem out) { + private WeightedSetItem fillWeightedSet(Inspector value, HashMap<Integer, Inspector> children, WeightedSetItem out) { addItems(children, out); return leafStyleSettings(getAnnotations(value), out); @@ -707,7 +694,6 @@ public class SelectParser implements Parser { }); } - @NonNull private Item buildRegExpSearch(String key, Inspector value) { assertHasOperator(key, MATCHES); HashMap<Integer, Inspector> children = childMap(value); @@ -717,7 +703,6 @@ public class SelectParser implements Parser { return leafStyleSettings(getAnnotations(value), regExp); } - @NonNull private Item buildWeightedSet(String key, Inspector value) { HashMap<Integer, Inspector> children = childMap(value); String field = children.get(0).asString(); @@ -725,7 +710,6 @@ public class SelectParser implements Parser { return fillWeightedSet(value, children, new WeightedSetItem(field)); } - @NonNull private Item buildDotProduct(String key, Inspector value) { HashMap<Integer, Inspector> children = childMap(value); String field = children.get(0).asString(); @@ -733,7 +717,6 @@ public class SelectParser implements Parser { return fillWeightedSet(value, children, new DotProductItem(field)); } - @NonNull private Item buildPredicate(String key, Inspector value) { HashMap<Integer, Inspector> children = childMap(value); String field = children.get(0).asString(); @@ -762,14 +745,12 @@ public class SelectParser implements Parser { return leafStyleSettings(getAnnotations(value), item); } - @NonNull private CompositeItem buildRank(String key, Inspector value) { RankItem rankItem = new RankItem(); addItemsFromInspector(rankItem, value); return rankItem; } - @NonNull private Item buildTermSearch(String key, Inspector value) { HashMap<Integer, Inspector> children = childMap(value); String field = children.get(0).asString(); @@ -788,7 +769,6 @@ public class SelectParser implements Parser { return actualKey[0]; } - @NonNull private Item instantiateLeafItem(String field, String key, Inspector value) { List<Inspector> possibleLeafFunction = valueListFromInspector(value); String possibleLeafFunctionName = (possibleLeafFunction.size() > 1) ? getInspectorKey(possibleLeafFunction.get(1)) : ""; @@ -801,7 +781,6 @@ public class SelectParser implements Parser { } } - @NonNull private Item instantiateCompositeLeaf(String field, String key, Inspector value) { switch (key) { case SAME_ELEMENT: @@ -821,7 +800,6 @@ public class SelectParser implements Parser { } } - @NonNull private Item instantiateWordItem(String field, String key, Inspector value) { var children = childMap(value); if (children.size() < 2) @@ -831,7 +809,6 @@ public class SelectParser implements Parser { return instantiateWordItem(field, wordData, key, value, false, decideParsingLanguage(value, wordData)); } - @NonNull private Item instantiateWordItem(String field, String rawWord, String key, Inspector value, boolean exactMatch, Language language) { String wordData = rawWord; HashMap<String, Inspector> annotations = getAnnotationMap(value); @@ -849,7 +826,6 @@ public class SelectParser implements Parser { Preconditions.checkArgument((prefixMatch ? 1 : 0) + (substrMatch ? 1 : 0) + (suffixMatch ? 1 : 0) < 2, "Only one of prefix, substring and suffix can be set."); - @NonNull final TaggableItem wordItem; if (exactMatch) { @@ -956,8 +932,6 @@ public class SelectParser implements Parser { return null; } - - @NonNull private Item instantiateSameElementItem(String field, String key, Inspector value) { assertHasOperator(key, SAME_ELEMENT); @@ -970,7 +944,6 @@ public class SelectParser implements Parser { return sameElement; } - @NonNull private Item instantiatePhraseItem(String field, String key, Inspector value) { assertHasOperator(key, PHRASE); @@ -988,7 +961,6 @@ public class SelectParser implements Parser { return leafStyleSettings(getAnnotations(value), phrase); } - @NonNull private Item instantiateNearItem(String field, String key, Inspector value) { assertHasOperator(key, NEAR); @@ -1009,7 +981,6 @@ public class SelectParser implements Parser { return near; } - @NonNull private Item instantiateONearItem(String field, String key, Inspector value) { assertHasOperator(key, ONEAR); @@ -1028,8 +999,6 @@ public class SelectParser implements Parser { return onear; } - - @NonNull private Item instantiateEquivItem(String field, String key, Inspector value) { HashMap<Integer, Inspector> children = childMap(value); @@ -1067,7 +1036,6 @@ public class SelectParser implements Parser { } // Not in use yet - @NonNull private String getIndex(String field) { Preconditions.checkArgument(indexFactsSession.isIndex(field), "Field '%s' does not exist.", field); //return indexFactsSession.getCanonicName(field); diff --git a/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java b/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java index 45d74da53eb..df9f2af0cce 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java +++ b/container-search/src/main/java/com/yahoo/search/yql/FieldFiller.java @@ -19,8 +19,6 @@ import com.yahoo.search.Searcher; import com.yahoo.search.query.Presentation; import com.yahoo.search.searchchain.Execution; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Ensure the fields specified in {@link Presentation#getSummaryFields()} are * available after filling phase. @@ -48,7 +46,6 @@ public class FieldFiller extends Searcher { docType.put(summary.name(), fields); } - @NonNull private Map<String, Set<String>> getOrCreateDocType(String dbName) { Map<String, Set<String>> docType = db.get(dbName); if (docType == null) { diff --git a/container-search/src/main/java/com/yahoo/search/yql/OperatorNode.java b/container-search/src/main/java/com/yahoo/search/yql/OperatorNode.java index 6c43955bead..431f159db01 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/OperatorNode.java +++ b/container-search/src/main/java/com/yahoo/search/yql/OperatorNode.java @@ -7,7 +7,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -166,9 +165,8 @@ final class OperatorNode<T extends Operator> { // we are aware only of types used in our logical operator trees -- OperatorNode, List, and constant values private static final Function<Object, Object> COPY = new Function<Object, Object>() { - @Nullable @Override - public Object apply(@Nullable Object input) { + public Object apply(Object input) { if (input instanceof List) { List<Object> newList = Lists.newArrayListWithExpectedSize(((List) input).size()); for (Object val : (List) input) { diff --git a/container-search/src/main/java/com/yahoo/search/yql/VespaSerializer.java b/container-search/src/main/java/com/yahoo/search/yql/VespaSerializer.java index f706310221c..f326903bff5 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/VespaSerializer.java +++ b/container-search/src/main/java/com/yahoo/search/yql/VespaSerializer.java @@ -102,8 +102,6 @@ import com.yahoo.search.Query; import com.yahoo.search.grouping.Continuation; import com.yahoo.search.grouping.GroupingRequest; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * Serialize Vespa query trees to YQL+ strings. * @@ -1391,7 +1389,7 @@ public class VespaSerializer { .append("\": ").append(length).append("}"); } - private static String normalizeIndexName(@NonNull String indexName) { + private static String normalizeIndexName(String indexName) { if (indexName.length() == 0) { return "default"; } else { diff --git a/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java b/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java index 9850deabcb9..b660d90072b 100644 --- a/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java +++ b/container-search/src/main/java/com/yahoo/search/yql/YqlParser.java @@ -77,8 +77,6 @@ import com.yahoo.search.query.parser.Parser; import com.yahoo.search.query.parser.ParserEnvironment; import com.yahoo.search.query.parser.ParserFactory; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * The YQL query language. * @@ -234,7 +232,6 @@ public class YqlParser implements Parser { this.environment = environment; } - @NonNull @Override public QueryTree parse(Parsable query) { indexFactsSession = indexFacts.newSession(query.getSources(), query.getRestrict()); @@ -267,7 +264,6 @@ public class YqlParser implements Parser { docTypes = new HashSet<>(indexFactsSession.documentTypes()); } - @NonNull private QueryTree buildTree(OperatorNode<?> filterPart) { Preconditions.checkArgument(filterPart.getArguments().length == 2, "Expected 2 arguments to filter, got %s.", @@ -395,7 +391,6 @@ public class YqlParser implements Parser { return item; } - @NonNull private Item buildWeightedSet(OperatorNode<ExpressionOperator> ast) { List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1); Preconditions.checkArgument(args.size() == 2, "Expected 2 arguments, got %s.", args.size()); @@ -403,7 +398,6 @@ public class YqlParser implements Parser { return fillWeightedSet(ast, args.get(1), new WeightedSetItem(getIndex(args.get(0)))); } - @NonNull private Item buildDotProduct(OperatorNode<ExpressionOperator> ast) { List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1); Preconditions.checkArgument(args.size() == 2, "Expected 2 arguments, got %s.", args.size()); @@ -411,7 +405,6 @@ public class YqlParser implements Parser { return fillWeightedSet(ast, args.get(1), new DotProductItem(getIndex(args.get(0)))); } - @NonNull private Item buildPredicate(OperatorNode<ExpressionOperator> ast) { List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1); Preconditions.checkArgument(args.size() == 3, "Expected 3 arguments, got %s.", args.size()); @@ -474,7 +467,6 @@ public class YqlParser implements Parser { } } - @NonNull private Item buildWand(OperatorNode<ExpressionOperator> ast) { List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1); Preconditions.checkArgument(args.size() == 2, "Expected 2 arguments, got %s.", args.size()); @@ -496,10 +488,9 @@ public class YqlParser implements Parser { return fillWeightedSet(ast, args.get(1), out); } - @NonNull private WeightedSetItem fillWeightedSet(OperatorNode<ExpressionOperator> ast, OperatorNode<ExpressionOperator> arg, - @NonNull WeightedSetItem out) { + WeightedSetItem out) { addItems(arg, out); return leafStyleSettings(ast, out); } @@ -515,7 +506,7 @@ public class YqlParser implements Parser { return prefix + leaf; } } - @NonNull + private Item instantiateSameElementItem(String field, OperatorNode<ExpressionOperator> ast) { assertHasFunctionName(ast, SAME_ELEMENT); @@ -529,7 +520,6 @@ public class YqlParser implements Parser { return sameElement; } - @NonNull private Item instantiatePhraseItem(String field, OperatorNode<ExpressionOperator> ast) { assertHasFunctionName(ast, PHRASE); @@ -564,7 +554,6 @@ public class YqlParser implements Parser { return leafStyleSettings(ast, phrase); } - @NonNull private Item instantiatePhraseSegmentItem(String field, OperatorNode<ExpressionOperator> ast, boolean forcePhrase) { Substring origin = getOrigin(ast); Boolean stem = getAnnotation(ast, STEM, Boolean.class, Boolean.TRUE, STEM_DESCRIPTION); @@ -600,7 +589,6 @@ public class YqlParser implements Parser { return phrase; } - @NonNull private Item instantiateNearItem(String field, OperatorNode<ExpressionOperator> ast) { assertHasFunctionName(ast, NEAR); @@ -616,7 +604,6 @@ public class YqlParser implements Parser { return near; } - @NonNull private Item instantiateONearItem(String field, OperatorNode<ExpressionOperator> ast) { assertHasFunctionName(ast, ONEAR); @@ -632,7 +619,6 @@ public class YqlParser implements Parser { return onear; } - @NonNull private Item fetchUserQuery() { Preconditions.checkState(!queryParser, "Tried inserting user query into itself."); Preconditions.checkState(userQuery != null, @@ -641,7 +627,6 @@ public class YqlParser implements Parser { return userQuery.getModel().getQueryTree().getRoot(); } - @NonNull private Item buildUserInput(OperatorNode<ExpressionOperator> ast) { // TODO add support for default arguments if property results in nothing List<OperatorNode<ExpressionOperator>> args = ast.getArgument(1); @@ -702,7 +687,6 @@ public class YqlParser implements Parser { ToolBox.visit(new AnnotationPropagator(ast), item); } - @NonNull private Item parseUserInput(String grammar, String defaultIndex, String wordData, Language language, boolean allowNullItem) { Query.Type parseAs = Query.Type.getType(grammar); @@ -721,7 +705,6 @@ public class YqlParser implements Parser { return item; } - @NonNull private OperatorNode<?> parseYqlProgram() { OperatorNode<?> ast; try { @@ -766,7 +749,6 @@ public class YqlParser implements Parser { return ast; } - @NonNull private OperatorNode<?> fetchSorting(OperatorNode<?> ast) { if (ast.getOperator() != SequenceOperator.SORT) return ast; @@ -840,7 +822,6 @@ public class YqlParser implements Parser { return ast.getArgument(0); } - @NonNull private OperatorNode<?> fetchOffsetAndHits(OperatorNode<?> ast) { if (ast.getOperator() == SequenceOperator.OFFSET) { offset = ast.<OperatorNode<?>> getArgument(1).<Integer> getArgument(0); @@ -860,7 +841,6 @@ public class YqlParser implements Parser { return ast; } - @NonNull private OperatorNode<?> fetchSummaryFields(OperatorNode<?> ast) { if (ast.getOperator() != SequenceOperator.PROJECT) return ast; @@ -1032,7 +1012,7 @@ public class YqlParser implements Parser { return convertVarArgs(spec, 1, new RankItem()); } - private CompositeItem convertVarArgs(OperatorNode<ExpressionOperator> ast, int argIdx, @NonNull CompositeItem out) { + private CompositeItem convertVarArgs(OperatorNode<ExpressionOperator> ast, int argIdx, CompositeItem out) { Iterable<OperatorNode<ExpressionOperator>> args = ast.getArgument(argIdx); for (OperatorNode<ExpressionOperator> arg : args) { assertHasOperator(arg, ExpressionOperator.class); @@ -1277,7 +1257,6 @@ public class YqlParser implements Parser { */ // TODO: Clean up such that there is one way to look up an Index instance // which always expands first, but not using getIndex, which performs checks that doesn't always work - @NonNull private Item instantiateWordItem(String field, String rawWord, OperatorNode<ExpressionOperator> ast, Class<?> parent, @@ -1389,7 +1368,7 @@ public class YqlParser implements Parser { wordStyleSettings(ast, wordItem); } - private <T extends TaggableItem> T leafStyleSettings(OperatorNode<?> ast, @NonNull T out) { + private <T extends TaggableItem> T leafStyleSettings(OperatorNode<?> ast, T out) { { Map<?, ?> connectivity = getAnnotation(ast, CONNECTIVITY, Map.class, null, "connectivity settings"); if (connectivity != null) { @@ -1473,7 +1452,7 @@ public class YqlParser implements Parser { public void setQueryParser(boolean queryParser) { this.queryParser = queryParser; } @Beta - public void setUserQuery(@NonNull Query userQuery) { this.userQuery = userQuery; } + public void setUserQuery(Query userQuery) { this.userQuery = userQuery; } @Beta public Set<String> getYqlSummaryFields() { return yqlSummaryFields; } diff --git a/document/src/main/java/com/yahoo/document/json/JsonWriter.java b/document/src/main/java/com/yahoo/document/json/JsonWriter.java index d7944246ff2..2e4097e1d6a 100644 --- a/document/src/main/java/com/yahoo/document/json/JsonWriter.java +++ b/document/src/main/java/com/yahoo/document/json/JsonWriter.java @@ -29,7 +29,6 @@ import com.yahoo.document.datatypes.WeightedSet; import com.yahoo.document.serialization.DocumentWriter; import com.yahoo.vespa.objects.FieldBase; import com.yahoo.vespa.objects.Serializer; -import edu.umd.cs.findbugs.annotations.NonNull; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -264,7 +263,7 @@ public class JsonWriter implements DocumentWriter { * the document to be serialized * @return the input document serialised as UTF-8 encoded JSON */ - public static byte[] toByteArray(@NonNull Document document) { + public static byte[] toByteArray(Document document) { ByteArrayOutputStream out = new ByteArrayOutputStream(); JsonWriter writer = new JsonWriter(out); writer.write(document); @@ -280,7 +279,7 @@ public class JsonWriter implements DocumentWriter { * @return a document remove operation serialised as UTF-8 encoded JSON for * the input document ID */ - public static byte[] documentRemove(@NonNull DocumentId docId) { + public static byte[] documentRemove(DocumentId docId) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try { JsonGenerator throwAway = jsonFactory.createGenerator(out); diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/UpdateHostResponse.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/UpdateHostResponse.java index 4e11d7af819..667abf09cd6 100644 --- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/UpdateHostResponse.java +++ b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/UpdateHostResponse.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; -import javax.annotation.Nullable; import java.util.Objects; /** @@ -23,7 +22,7 @@ public class UpdateHostResponse { @JsonCreator public UpdateHostResponse( @JsonProperty(FIELD_NAME_HOSTNAME) final String hostname, - @JsonProperty(FIELD_NAME_REASON) @Nullable final HostStateChangeDenialReason hostStateChangeDenialReason) { + @JsonProperty(FIELD_NAME_REASON) final HostStateChangeDenialReason hostStateChangeDenialReason) { this.hostname = hostname; this.hostStateChangeDenialReason = hostStateChangeDenialReason; } @@ -33,7 +32,7 @@ public class UpdateHostResponse { return hostname; } - @JsonProperty(FIELD_NAME_REASON) @Nullable + @JsonProperty(FIELD_NAME_REASON) public HostStateChangeDenialReason reason() { return hostStateChangeDenialReason; } diff --git a/serviceview/src/main/java/com/yahoo/vespa/serviceview/bindings/ServicePort.java b/serviceview/src/main/java/com/yahoo/vespa/serviceview/bindings/ServicePort.java index a82069ea01d..6fd2f22528a 100644 --- a/serviceview/src/main/java/com/yahoo/vespa/serviceview/bindings/ServicePort.java +++ b/serviceview/src/main/java/com/yahoo/vespa/serviceview/bindings/ServicePort.java @@ -6,8 +6,6 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.google.common.base.Splitter; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * View of {@link com.yahoo.cloud.config.ModelConfig.Hosts.Services.Ports}. * @@ -28,7 +26,7 @@ public class ServicePort { * @return true if all argument tags are present for this port, false * otherwise */ - public boolean hasTags(@NonNull String... tag) { + public boolean hasTags(String... tag) { if (tags == null) { return false; } diff --git a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Bucket.java b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Bucket.java index 5e7b60411c9..edb9e4820d1 100644 --- a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Bucket.java +++ b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Bucket.java @@ -16,8 +16,6 @@ import com.yahoo.collections.LazyMap; import com.yahoo.collections.LazySet; import com.yahoo.log.LogLevel; -import edu.umd.cs.findbugs.annotations.NonNull; - /** * An aggregation of data which is only written to from a single thread. * @@ -136,7 +134,7 @@ public class Bucket { return names; } - public Collection<Map.Entry<Point, UntypedMetric>> getValuesForMetric(@NonNull String metricName) { + public Collection<Map.Entry<Point, UntypedMetric>> getValuesForMetric(String metricName) { List<Map.Entry<Point, UntypedMetric>> singleMetric = new ArrayList<>(); for (Map.Entry<Identifier, UntypedMetric> entry : values.entrySet()) { if (metricName.equals(entry.getKey().getName())) { @@ -146,7 +144,7 @@ public class Bucket { return singleMetric; } - public Map<Point, UntypedMetric> getMapForMetric(@NonNull String metricName) { + public Map<Point, UntypedMetric> getMapForMetric(String metricName) { Map<Point, UntypedMetric> result = new HashMap<>(); for (Map.Entry<Identifier, UntypedMetric> entry : values.entrySet()) { if (metricName.equals(entry.getKey().getName())) { diff --git a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Gauge.java b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Gauge.java index 0ddb99e375d..1edefd0ae5a 100644 --- a/simplemetrics/src/main/java/com/yahoo/metrics/simple/Gauge.java +++ b/simplemetrics/src/main/java/com/yahoo/metrics/simple/Gauge.java @@ -4,8 +4,6 @@ package com.yahoo.metrics.simple; import com.google.common.annotations.Beta; import com.yahoo.metrics.simple.UntypedMetric.AssumedType; -import edu.umd.cs.findbugs.annotations.Nullable; - /** * A gauge metric, i.e. a bucket of arbitrary sample values. Create a gauge * metric by declaring it with {@link MetricReceiver#declareGauge(String)} or @@ -15,7 +13,7 @@ import edu.umd.cs.findbugs.annotations.Nullable; */ @Beta public class Gauge { - @Nullable + private final Point defaultPosition; private final String name; private final MetricReceiver receiver; |