Reduce JSR305 proliferation 11/80211/6
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 7 Feb 2019 16:53:09 +0000 (17:53 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 12 Feb 2019 09:12:04 +0000 (09:12 +0000)
retention=runtime annotations are mixing really badly with Java EE
injection and Java 11.

Make sure we do not use javax.annotation package in APIs and reduce
overall proliferation inside implementations.

Change-Id: I569815f0336efdc0de662c3b80f0fa6e5dd47d8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
163 files changed:
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/AbstractDependentComponentFactoryMetadata.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/DataStoreAppConfigMetadata.java
opendaylight/config/netty-timer-config/src/main/java/org/opendaylight/controller/config/yang/netty/timer/HashedWheelTimerCloseable.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/ABIVersion.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/AbstractVersionException.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/AbortLocalTransactionRequest.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/AbstractReadPathTransactionRequest.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/CommitLocalTransactionRequest.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ConnectClientRequest.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ConnectClientSuccess.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ExistsTransactionRequest.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/commands/ReadTransactionRequest.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractMessageProxy.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractRequestFailureProxy.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractRequestProxy.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractResponseProxy.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/AbstractSuccessProxy.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/FrontendType.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/Message.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/Request.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/RequestException.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/RequestFailure.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/RequestSuccess.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/Response.java
opendaylight/md-sal/cds-access-api/src/main/java/org/opendaylight/controller/cluster/access/concepts/TransactionIdentifier.java
opendaylight/md-sal/cds-access-api/src/test/java/org/opendaylight/controller/cluster/access/concepts/FailureEnvelopeTest.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientActorBehavior.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientActorContext.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/BackendInfoResolver.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ClientActorBehavior.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ClientActorContext.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/InternalCommand.java
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/RequestCallback.java
opendaylight/md-sal/cds-dom-api/src/main/java/org/opendaylight/controller/cluster/dom/api/CDSDataTreeProducer.java
opendaylight/md-sal/cds-dom-api/src/main/java/org/opendaylight/controller/cluster/dom/api/CDSShardAccess.java
opendaylight/md-sal/cds-dom-api/src/main/java/org/opendaylight/controller/cluster/dom/api/LeaderLocationListener.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/closetracker/impl/AbstractCloseTracked.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/closetracker/impl/CloseTracked.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/closetracker/impl/CloseTrackedTrait.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/AbstractTracingWriteTransaction.java
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/java/org/opendaylight/controller/md/sal/trace/dom/impl/TracingBroker.java
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java
opendaylight/md-sal/sal-akka-raft-example/src/main/java/org/opendaylight/controller/cluster/example/ExampleActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ConfigParams.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/DefaultConfigParamsImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ElectionTerm.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/FollowerLogInformation.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/PeerAddressResolver.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContext.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorLeadershipTransferCohort.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoveryCohort.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorServerConfigurationSupport.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorSnapshotCohort.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLog.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/ReplicatedLogImpl.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/ApplySnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/CaptureSnapshotReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/FollowerInitialSyncUpStatus.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/LeaderTransitioning.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/base/messages/SendInstallSnapshot.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Follower.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/IsolatedLeader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/RaftActorBehavior.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/FindLeaderReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/GetSnapshotReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/client/messages/OnDemandRaftState.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AbstractServerChangeReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/AppendEntries.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/ChangeServersVotingStatus.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/messages/RemoveServerReply.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/MigratedSerializable.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerConfigurationPayload.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/persisted/ServerInfo.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/MockRaftActor.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/ReplicationAndSnapshotsWithLaggingFollowerIntegrationTest.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/persisted/ByteState.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/DataObjectModification.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/DataTreeChangeListener.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/DataTreeChangeService.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/DataTreeIdentifier.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/DataTreeModification.java
opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/md/sal/binding/api/ForwardingDataBroker.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/FunctionalNotificationListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcImplementationAdapter.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingToNormalizedNodeCodec.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ContextReferenceExtractor.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/spi/AdapterLoader.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/ActorSystemProvider.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/utils/stream/NormalizedNodeInputOutput.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/util/AbstractDataTreeModificationCursor.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/io/FileBackedOutputStream.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/io/FileBackedOutputStreamFactory.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageAssembler.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/messaging/MessageSlicer.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/notifications/LeaderStateChanged.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/RemoteYangTextSourceProvider.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/RemoteYangTextSourceProviderImpl.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/MappingCheckedFuture.java
opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncWriteTransaction.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/AbstractMXBean.java
opendaylight/md-sal/sal-common-util/src/main/java/org/opendaylight/controller/md/sal/common/util/jmx/ThreadExecutorStatsMXBeanImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/CDSShardAccessImpl.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataTreeChangeListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataTreeChangeService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataTreeIdentifier.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMExtensibleService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcAvailabilityListener.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcIdentifier.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcImplementation.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcImplementationNotAvailableException.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcProviderService.java
opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMRpcService.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/AbstractDOMDataBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongDataBroker.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/jmx/CommitStatsMXBeanImpl.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/LegacyShardedDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/legacy/sharded/adapter/ShardedDOMDataBrokerDelegatingReadWriteTransaction.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMDataTreeListenerTest.java
opendaylight/md-sal/sal-dom-broker/src/test/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterTest.java
opendaylight/md-sal/sal-dom-compat/src/main/java/org/opendaylight/controller/sal/core/compat/LegacyDOMDataBrokerAdapter.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/DefaultDOMRpcResult.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataBroker.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataReadOnlyTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataReadWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMDataWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMRpcImplementation.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMRpcProviderService.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMRpcResult.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMRpcService.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/md/sal/dom/spi/ForwardingDOMTransactionChain.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractDOMStoreTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/AbstractDOMStoreTreeChangePublisher.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/DOMStoreTreeChangePublisher.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/SnapshotBackedWriteTransaction.java
opendaylight/md-sal/sal-dom-spi/src/main/java/org/opendaylight/controller/sal/core/spi/data/statistics/DOMStoreStatsTracker.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMDataStoreFactory.java
opendaylight/md-sal/sal-inmemory-datastore/src/main/java/org/opendaylight/controller/md/sal/dom/store/impl/InMemoryDOMStoreTreeChangePublisher.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteDOMRpcFuture.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcListener.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteRpc.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RpcResponse.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/Bucket.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/gossip/BucketImpl.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarDataTreeChangeListener.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/GetConstantService.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/IdIntsDOMDataTreeLIstener.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/IdIntsListener.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/PrefixShardHandler.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/RoutedGetConstantService.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/SingletonGetConstantService.java

index b79d366..ebc6975 100644 (file)
@@ -16,11 +16,11 @@ import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
-import javax.annotation.Nullable;
 import org.apache.aries.blueprint.NamespaceHandler;
 import org.apache.aries.blueprint.services.BlueprintExtenderService;
 import org.apache.aries.quiesce.participant.QuiesceParticipant;
 import org.apache.aries.util.AriesFrameworkUtil;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.blueprint.ext.OpendaylightNamespaceHandler;
 import org.opendaylight.yangtools.util.xml.UntrustedXML;
 import org.osgi.framework.Bundle;
@@ -342,8 +342,7 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus
         return bundlesToDestroy;
     }
 
-    @Nullable
-    private Bundle findBundleWithHighestUsedServiceId(final Collection<Bundle> containerBundles) {
+    private @Nullable Bundle findBundleWithHighestUsedServiceId(final Collection<Bundle> containerBundles) {
         ServiceReference<?> highestServiceRef = null;
         for (Bundle bundle : containerBundles) {
             ServiceReference<?>[] references = bundle.getRegisteredServices();
index 37343b9..b7953e4 100644 (file)
@@ -14,13 +14,13 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Consumer;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import org.apache.aries.blueprint.di.AbstractRecipe;
 import org.apache.aries.blueprint.di.ExecutionContext;
 import org.apache.aries.blueprint.di.Recipe;
 import org.apache.aries.blueprint.ext.DependentComponentFactoryMetadata;
 import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.blueprint.BlueprintContainerRestartService;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
@@ -225,8 +225,7 @@ abstract class AbstractDependentComponentFactoryMetadata implements DependentCom
     }
 
     @SuppressWarnings("unchecked")
-    @Nullable
-    protected <T> T getOSGiService(final Class<T> serviceInterface) {
+    protected <T> @Nullable T getOSGiService(final Class<T> serviceInterface) {
         try {
             ServiceReference<T> serviceReference =
                     container().getBundleContext().getServiceReference(serviceInterface);
index b2801d0..b018fc4 100644 (file)
@@ -17,11 +17,11 @@ import java.util.Collection;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.concurrent.atomic.AtomicBoolean;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 import org.apache.aries.blueprint.services.ExtendedBlueprintContainer;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.blueprint.ext.DataStoreAppConfigDefaultXMLReader.ConfigURLProvider;
 import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -79,9 +79,9 @@ public class DataStoreAppConfigMetadata extends AbstractDependentComponentFactor
     // project are still used - conversion to the mdsal binding classes hasn't occurred yet.
     private volatile BindingNormalizedNodeSerializer bindingSerializer;
 
-    public DataStoreAppConfigMetadata(@Nonnull final String id, @Nonnull final String appConfigBindingClassName,
-            @Nullable final String appConfigListKeyValue, @Nullable final String defaultAppConfigFileName,
-            @Nonnull final UpdateStrategy updateStrategyValue, @Nullable final Element defaultAppConfigElement) {
+    public DataStoreAppConfigMetadata(final String id, final @NonNull String appConfigBindingClassName,
+            final @Nullable String appConfigListKeyValue, final @Nullable String defaultAppConfigFileName,
+            final @NonNull UpdateStrategy updateStrategyValue, final @Nullable Element defaultAppConfigElement) {
         super(id);
         this.defaultAppConfigElement = defaultAppConfigElement;
         this.defaultAppConfigFileName = defaultAppConfigFileName;
@@ -279,8 +279,7 @@ public class DataStoreAppConfigMetadata extends AbstractDependentComponentFactor
         }
     }
 
-    @Nullable
-    private NormalizedNode<?, ?> parsePossibleDefaultAppConfigElement(final SchemaContext schemaContext,
+    private @Nullable NormalizedNode<?, ?> parsePossibleDefaultAppConfigElement(final SchemaContext schemaContext,
             final DataSchemaNode dataSchema) throws URISyntaxException, IOException, ParserConfigurationException,
             SAXException, XMLStreamException {
         if (defaultAppConfigElement == null) {
index de187bb..b519af1 100644 (file)
@@ -14,7 +14,7 @@ import io.netty.util.TimerTask;
 import java.util.Set;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 public final class HashedWheelTimerCloseable implements AutoCloseable, Timer {
 
@@ -39,13 +39,13 @@ public final class HashedWheelTimerCloseable implements AutoCloseable, Timer {
         return this.timer.stop();
     }
 
-    public static HashedWheelTimerCloseable newInstance(@Nullable final Long duration,
-            @Nullable final Integer ticksPerWheel) {
+    public static HashedWheelTimerCloseable newInstance(final @Nullable Long duration,
+            final @Nullable Integer ticksPerWheel) {
         return newInstance(null, duration, ticksPerWheel);
     }
 
-    public static HashedWheelTimerCloseable newInstance(@Nullable final ThreadFactory threadFactory,
-            @Nullable final Long duration, @Nullable final Integer ticksPerWheel) {
+    public static HashedWheelTimerCloseable newInstance(final @Nullable ThreadFactory threadFactory,
+            final @Nullable Long duration, final @Nullable Integer ticksPerWheel) {
         TimeUnit unit = TimeUnit.MILLISECONDS;
         if(!nullOrNonPositive(duration) && threadFactory == null && nullOrNonPositive(ticksPerWheel)) {
             return new HashedWheelTimerCloseable(new HashedWheelTimer(duration, unit));
index b476536..3eddf3e 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.access;
 
+import static com.google.common.base.Preconditions.checkArgument;
+
 import com.google.common.annotations.Beta;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,7 +51,7 @@ public enum ABIVersion implements WritableObject {
     private final short value;
 
     ABIVersion(final int intVersion) {
-        Preconditions.checkArgument(intVersion >= 0 && intVersion <= 65535);
+        checkArgument(intVersion >= 0 && intVersion <= 65535);
         value = (short) intVersion;
     }
 
@@ -69,8 +70,7 @@ public enum ABIVersion implements WritableObject {
      *
      * @return Current {@link ABIVersion}
      */
-    @Nonnull
-    public static ABIVersion current() {
+    public static @NonNull ABIVersion current() {
         return BORON;
     }
 
@@ -83,8 +83,7 @@ public enum ABIVersion implements WritableObject {
      * @throws FutureVersionException if the specified integer identifies a future version
      * @throws PastVersionException if the specified integer identifies a past version which is no longer supported
      */
-    @Nonnull
-    public static ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
+    public static @NonNull ABIVersion valueOf(final short value) throws FutureVersionException, PastVersionException {
         switch (Short.toUnsignedInt(value)) {
             case 0:
             case 1:
@@ -112,8 +111,7 @@ public enum ABIVersion implements WritableObject {
      * @return An {@link ABIVersion}
      * @throws IOException If read fails or an unsupported version is encountered
      */
-    @Nonnull
-    public static ABIVersion readFrom(@Nonnull final DataInput in) throws IOException {
+    public static @NonNull ABIVersion readFrom(final @NonNull DataInput in) throws IOException {
         final short s = in.readShort();
         try {
             return valueOf(s);
@@ -122,7 +120,7 @@ public enum ABIVersion implements WritableObject {
         }
     }
 
-    public static ABIVersion inexactReadFrom(@Nonnull final DataInput in) throws IOException {
+    public static @NonNull ABIVersion inexactReadFrom(final @NonNull DataInput in) throws IOException {
         final short onWire = in.readShort();
         try {
             return ABIVersion.valueOf(onWire);
index e416fc6..0567ef1 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Abstract base exception used for reporting version mismatches from {@link ABIVersion}.
@@ -19,12 +20,12 @@ import javax.annotation.Nonnull;
 @Beta
 public abstract class AbstractVersionException extends Exception {
     private static final long serialVersionUID = 1L;
-    private final ABIVersion closestVersion;
+    private final @NonNull ABIVersion closestVersion;
     private final int version;
 
     AbstractVersionException(final String message, final short version, final ABIVersion closestVersion) {
         super(message);
-        this.closestVersion = Preconditions.checkNotNull(closestVersion);
+        this.closestVersion = requireNonNull(closestVersion);
         this.version = Short.toUnsignedInt(version);
     }
 
@@ -42,8 +43,7 @@ public abstract class AbstractVersionException extends Exception {
      *
      * @return Closest supported {@link ABIVersion}
      */
-    @Nonnull
-    public final ABIVersion getClosestVersion() {
+    public final @NonNull ABIVersion getClosestVersion() {
         return closestVersion;
     }
 
index 19df546..3898ee2 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.access.commands;
 
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 
 /**
@@ -23,8 +23,8 @@ import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier
 public final class AbortLocalTransactionRequest extends AbstractLocalTransactionRequest<AbortLocalTransactionRequest> {
     private static final long serialVersionUID = 1L;
 
-    public AbortLocalTransactionRequest(@Nonnull final TransactionIdentifier identifier,
-            @Nonnull final ActorRef replyTo) {
+    public AbortLocalTransactionRequest(final @NonNull TransactionIdentifier identifier,
+            final @NonNull ActorRef replyTo) {
         super(identifier, 0, replyTo);
     }
 }
index fee3b03..fa53a59 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -32,12 +33,13 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 public abstract class AbstractReadPathTransactionRequest<T extends AbstractReadPathTransactionRequest<T>>
         extends AbstractReadTransactionRequest<T> {
     private static final long serialVersionUID = 1L;
-    private final YangInstanceIdentifier path;
+
+    private final @NonNull YangInstanceIdentifier path;
 
     AbstractReadPathTransactionRequest(final TransactionIdentifier identifier, final long sequence,
         final ActorRef replyTo, final YangInstanceIdentifier path, final boolean snapshotOnly) {
         super(identifier, sequence, replyTo, snapshotOnly);
-        this.path = Preconditions.checkNotNull(path);
+        this.path = requireNonNull(path);
     }
 
     AbstractReadPathTransactionRequest(final T request, final ABIVersion version) {
@@ -45,8 +47,7 @@ public abstract class AbstractReadPathTransactionRequest<T extends AbstractReadP
         this.path = request.getPath();
     }
 
-    @Nonnull
-    public final YangInstanceIdentifier getPath() {
+    public final @NonNull YangInstanceIdentifier getPath() {
         return path;
     }
 
index 5cff1a8..adef0c3 100644 (file)
@@ -7,14 +7,15 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 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.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
 
@@ -36,11 +37,11 @@ public final class CommitLocalTransactionRequest
     private final Exception delayedFailure;
     private final boolean coordinated;
 
-    public CommitLocalTransactionRequest(@Nonnull final TransactionIdentifier identifier, final long sequence,
-            @Nonnull final ActorRef replyTo, @Nonnull final DataTreeModification mod,
-            @Nullable final Exception delayedFailure, final boolean coordinated) {
+    public CommitLocalTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
+            final @NonNull ActorRef replyTo, final @NonNull DataTreeModification mod,
+            final @Nullable Exception delayedFailure, final boolean coordinated) {
         super(identifier, sequence, replyTo);
-        this.mod = Preconditions.checkNotNull(mod);
+        this.mod = requireNonNull(mod);
         this.delayedFailure = delayedFailure;
         this.coordinated = coordinated;
     }
index be888e2..ba86035 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.concepts.AbstractRequestProxy;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
@@ -39,8 +39,8 @@ public final class ConnectClientRequest extends Request<ClientIdentifier, Connec
     ConnectClientRequest(final ClientIdentifier identifier, final long txSequence, final ActorRef replyTo,
             final ABIVersion minVersion, final ABIVersion maxVersion) {
         super(identifier, txSequence, replyTo);
-        this.minVersion = Preconditions.checkNotNull(minVersion);
-        this.maxVersion = Preconditions.checkNotNull(maxVersion);
+        this.minVersion = requireNonNull(minVersion);
+        this.maxVersion = requireNonNull(maxVersion);
     }
 
     public ConnectClientRequest(final ClientIdentifier identifier, final ActorRef replyTo, final ABIVersion minVersion,
@@ -79,8 +79,7 @@ public final class ConnectClientRequest extends Request<ClientIdentifier, Connec
     }
 
     @Override
-    @Nonnull
-    protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) {
+    protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
         return super.addToStringAttributes(toStringHelper).add("minVersion", minVersion).add("maxVersion", maxVersion);
     }
 }
index 90eff1b..1ec81c8 100644 (file)
@@ -7,16 +7,18 @@
  */
 package org.opendaylight.controller.cluster.access.commands;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.List;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.access.concepts.RequestSuccess;
@@ -36,26 +38,26 @@ public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier,
     @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
             + "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class "
             + "aren't serialized. FindBugs does not recognize this.")
-    private final List<ActorSelection> alternates;
+    private final @NonNull List<ActorSelection> alternates;
 
     @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "See justification above.")
     private final DataTree dataTree;
-    private final ActorRef backend;
+    private final @NonNull ActorRef backend;
     private final int maxMessages;
 
     ConnectClientSuccess(final ClientIdentifier target, final long sequence, final ActorRef backend,
         final List<ActorSelection> alternates, final Optional<DataTree> dataTree, final int maxMessages) {
         super(target, sequence);
-        this.backend = Preconditions.checkNotNull(backend);
+        this.backend = requireNonNull(backend);
         this.alternates = ImmutableList.copyOf(alternates);
         this.dataTree = dataTree.orElse(null);
-        Preconditions.checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
+        checkArgument(maxMessages > 0, "Maximum messages has to be positive, not %s", maxMessages);
         this.maxMessages = maxMessages;
     }
 
-    public ConnectClientSuccess(@Nonnull final ClientIdentifier target, final long sequence,
-            @Nonnull final ActorRef backend, @Nonnull final List<ActorSelection> alternates,
-            @Nonnull final DataTree dataTree, final int maxMessages) {
+    public ConnectClientSuccess(final @NonNull ClientIdentifier target, final long sequence,
+            final @NonNull ActorRef backend, final @NonNull List<ActorSelection> alternates,
+            final @NonNull DataTree dataTree, final int maxMessages) {
         this(target, sequence, backend, alternates, Optional.of(dataTree), maxMessages);
     }
 
@@ -64,13 +66,11 @@ public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier,
      *
      * @return a list of known backend alternates
      */
-    @Nonnull
-    public List<ActorSelection> getAlternates() {
+    public @NonNull List<ActorSelection> getAlternates() {
         return alternates;
     }
 
-    @Nonnull
-    public ActorRef getBackend() {
+    public @NonNull ActorRef getBackend() {
         return backend;
     }
 
index f5534a8..ab2316c 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.access.commands;
 
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -23,8 +23,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 public final class ExistsTransactionRequest extends AbstractReadPathTransactionRequest<ExistsTransactionRequest> {
     private static final long serialVersionUID = 1L;
 
-    public ExistsTransactionRequest(@Nonnull final TransactionIdentifier identifier, final long sequence,
-            @Nonnull final ActorRef replyTo, @Nonnull final YangInstanceIdentifier path, final boolean snapshotOnly) {
+    public ExistsTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
+            final @NonNull  ActorRef replyTo, final @NonNull YangInstanceIdentifier path, final boolean snapshotOnly) {
         super(identifier, sequence, replyTo, path, snapshotOnly);
     }
 
index 4eb5d1a..92caa59 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.access.commands;
 
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -23,8 +23,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 public final class ReadTransactionRequest extends AbstractReadPathTransactionRequest<ReadTransactionRequest> {
     private static final long serialVersionUID = 1L;
 
-    public ReadTransactionRequest(@Nonnull final TransactionIdentifier identifier, final long sequence,
-            @Nonnull final ActorRef replyTo, @Nonnull final YangInstanceIdentifier path, final boolean snapshotOnly) {
+    public ReadTransactionRequest(final @NonNull TransactionIdentifier identifier, final long sequence,
+            final @NonNull ActorRef replyTo, final @NonNull YangInstanceIdentifier path, final boolean snapshotOnly) {
         super(identifier, sequence, replyTo, path, snapshotOnly);
     }
 
index 8a59168..0367527 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verifyNotNull;
+
 import java.io.DataInput;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 import org.opendaylight.yangtools.concepts.WritableObjects;
 
@@ -34,7 +35,7 @@ abstract class AbstractMessageProxy<T extends WritableIdentifier, C extends Mess
         // For Externalizable
     }
 
-    AbstractMessageProxy(@Nonnull final C message) {
+    AbstractMessageProxy(final @NonNull C message) {
         this.target = message.getTarget();
         this.sequence = message.getSequence();
     }
@@ -47,17 +48,15 @@ abstract class AbstractMessageProxy<T extends WritableIdentifier, C extends Mess
 
     @Override
     public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
-        target = Verify.verifyNotNull(readTarget(in));
+        target = verifyNotNull(readTarget(in));
         sequence = WritableObjects.readLong(in);
     }
 
     protected final Object readResolve() {
-        return Verify.verifyNotNull(createMessage(target, sequence));
+        return verifyNotNull(createMessage(target, sequence));
     }
 
-    @Nonnull
-    protected abstract T readTarget(@Nonnull DataInput in) throws IOException;
+    protected abstract @NonNull T readTarget(@NonNull DataInput in) throws IOException;
 
-    @Nonnull
-    abstract C createMessage(@Nonnull T msgTarget, long msgSequence);
+    abstract @NonNull C createMessage(@NonNull T msgTarget, long msgSequence);
 }
index 28d09ed..e35936d 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.annotations.Beta;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
 /**
@@ -31,7 +31,7 @@ public abstract class AbstractRequestFailureProxy<T extends WritableIdentifier,
         // For Externalizable
     }
 
-    protected AbstractRequestFailureProxy(@Nonnull final C failure) {
+    protected AbstractRequestFailureProxy(final @NonNull C failure) {
         super(failure);
         this.cause = failure.getCause();
     }
@@ -53,6 +53,6 @@ public abstract class AbstractRequestFailureProxy<T extends WritableIdentifier,
         return createFailure(target, sequence, cause);
     }
 
-    @Nonnull
-    protected abstract C createFailure(@Nonnull T target, long sequence, @Nonnull RequestException failureCause);
+    protected abstract @NonNull C createFailure(@NonNull T target, long sequence,
+            @NonNull RequestException failureCause);
 }
index f73453f..183766f 100644 (file)
@@ -14,7 +14,7 @@ import com.google.common.annotations.Beta;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
 /**
@@ -34,7 +34,7 @@ public abstract class AbstractRequestProxy<T extends WritableIdentifier, C exten
         // For Externalizable
     }
 
-    protected AbstractRequestProxy(@Nonnull final C request) {
+    protected AbstractRequestProxy(final @NonNull C request) {
         super(request);
         this.replyTo = request.getReplyTo();
     }
@@ -52,11 +52,9 @@ public abstract class AbstractRequestProxy<T extends WritableIdentifier, C exten
     }
 
     @Override
-    @Nonnull
-    final C createMessage(@Nonnull final T target, final long sequence) {
+    final C createMessage(final T target, final long sequence) {
         return createRequest(target, sequence, replyTo);
     }
 
-    @Nonnull
-    protected abstract C createRequest(@Nonnull T target, long sequence, @Nonnull ActorRef replyToActor);
+    protected abstract @NonNull C createRequest(@NonNull T target, long sequence, @NonNull ActorRef replyToActor);
 }
index b72b2b9..c9edfdb 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
 /**
@@ -26,7 +26,7 @@ abstract class AbstractResponseProxy<T extends WritableIdentifier, C extends Res
         // for Externalizable
     }
 
-    AbstractResponseProxy(@Nonnull final C response) {
+    AbstractResponseProxy(final @NonNull C response) {
         super(response);
     }
 
@@ -35,6 +35,5 @@ abstract class AbstractResponseProxy<T extends WritableIdentifier, C extends Res
         return createResponse(target, sequence);
     }
 
-    @Nonnull
-    abstract C createResponse(@Nonnull T target, long sequence);
+    abstract @NonNull C createResponse(@NonNull T target, long sequence);
 }
index 6a46f23..ecf792e 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.access.concepts;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
 /**
@@ -27,7 +27,7 @@ public abstract class AbstractSuccessProxy<T extends WritableIdentifier, C exten
         // For Externalizable
     }
 
-    protected AbstractSuccessProxy(@Nonnull final C success) {
+    protected AbstractSuccessProxy(final @NonNull C success) {
         super(success);
     }
 
@@ -36,6 +36,5 @@ public abstract class AbstractSuccessProxy<T extends WritableIdentifier, C exten
         return createSuccess(target, sequence);
     }
 
-    @Nonnull
-    protected abstract C createSuccess(@Nonnull T target, long sequence);
+    protected abstract @NonNull C createSuccess(@NonNull T target, long sequence);
 }
index 95857e8..b6a7b4b 100644 (file)
@@ -7,11 +7,13 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
-import com.google.common.base.Verify;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -21,7 +23,6 @@ import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.nio.charset.StandardCharsets;
 import java.util.regex.Pattern;
-import javax.annotation.RegEx;
 import org.opendaylight.yangtools.concepts.Identifier;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -46,7 +47,7 @@ public final class FrontendType implements Comparable<FrontendType>, WritableIde
         }
 
         Proxy(final byte[] serialized) {
-            this.serialized = Preconditions.checkNotNull(serialized);
+            this.serialized = requireNonNull(serialized);
         }
 
         @Override
@@ -67,7 +68,6 @@ public final class FrontendType implements Comparable<FrontendType>, WritableIde
         }
     }
 
-    @RegEx
     private static final String SIMPLE_STRING_REGEX = "^[a-zA-Z0-9-_.*+:=,!~';]+$";
     private static final Pattern SIMPLE_STRING_PATTERN = Pattern.compile(SIMPLE_STRING_REGEX);
     private static final long serialVersionUID = 1L;
@@ -78,12 +78,12 @@ public final class FrontendType implements Comparable<FrontendType>, WritableIde
     private volatile byte[] serialized;
 
     private FrontendType(final String name) {
-        this.name = Preconditions.checkNotNull(name);
+        this.name = requireNonNull(name);
     }
 
     FrontendType(final String name, final byte[] serialized) {
         this(name);
-        this.serialized = Verify.verifyNotNull(serialized);
+        this.serialized = verifyNotNull(serialized);
     }
 
     /**
@@ -97,8 +97,8 @@ public final class FrontendType implements Comparable<FrontendType>, WritableIde
      * @throws IllegalArgumentException if the string is null, empty or contains invalid characters
      */
     public static FrontendType forName(final String name) {
-        Preconditions.checkArgument(!Strings.isNullOrEmpty(name));
-        Preconditions.checkArgument(SIMPLE_STRING_PATTERN.matcher(name).matches(),
+        checkArgument(!Strings.isNullOrEmpty(name));
+        checkArgument(SIMPLE_STRING_PATTERN.matcher(name).matches(),
             "Supplied name %s does not patch pattern %s", name, SIMPLE_STRING_REGEX);
         return new FrontendType(name);
     }
index 8788c0d..2bc33cd 100644 (file)
@@ -7,14 +7,15 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
@@ -56,13 +57,13 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
         Serializable {
     private static final long serialVersionUID = 1L;
 
-    private final ABIVersion version;
+    private final @NonNull ABIVersion version;
     private final long sequence;
-    private final T target;
+    private final @NonNull T target;
 
     private Message(final ABIVersion version, final T target, final long sequence) {
-        this.target = Preconditions.checkNotNull(target);
-        this.version = Preconditions.checkNotNull(version);
+        this.target = requireNonNull(target);
+        this.version = requireNonNull(version);
         this.sequence = sequence;
     }
 
@@ -79,8 +80,7 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      *
      * @return Target identifier
      */
-    @Nonnull
-    public final T getTarget() {
+    public final @NonNull T getTarget() {
         return target;
     }
 
@@ -94,8 +94,7 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
     }
 
     @VisibleForTesting
-    @Nonnull
-    public final ABIVersion getVersion() {
+    public final @NonNull ABIVersion getVersion() {
         return version;
     }
 
@@ -106,15 +105,14 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      * @return A new message which will use ABIVersion as its serialization.
      */
     @SuppressWarnings("unchecked")
-    @Nonnull
-    public final C toVersion(@Nonnull final ABIVersion toVersion) {
+    public final @NonNull C toVersion(final @NonNull ABIVersion toVersion) {
         if (this.version == toVersion) {
             return (C)this;
         }
 
         switch (toVersion) {
             case BORON:
-                return Verify.verifyNotNull(cloneAsVersion(toVersion));
+                return verifyNotNull(cloneAsVersion(toVersion));
             case TEST_PAST_VERSION:
             case TEST_FUTURE_VERSION:
             default:
@@ -134,8 +132,7 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      * @return A message with the specified serialization stream
      * @throws IllegalArgumentException if this message does not support the target ABI
      */
-    @Nonnull
-    protected abstract C cloneAsVersion(@Nonnull ABIVersion targetVersion);
+    protected abstract @NonNull C cloneAsVersion(@NonNull ABIVersion targetVersion);
 
     @Override
     public final String toString() {
@@ -150,8 +147,7 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      * @return The {@link ToStringHelper} passed in as argument
      * @throws NullPointerException if toStringHelper is null
      */
-    @Nonnull
-    protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) {
+    protected @NonNull ToStringHelper addToStringAttributes(final @NonNull ToStringHelper toStringHelper) {
         return toStringHelper.add("target", target).add("sequence", Long.toUnsignedString(sequence));
     }
 
@@ -163,8 +159,7 @@ public abstract class Message<T extends WritableIdentifier, C extends Message<T,
      * @param reqVersion Requested ABI version
      * @return Proxy for this object
      */
-    @Nonnull
-    abstract AbstractMessageProxy<T, C> externalizableProxy(@Nonnull ABIVersion reqVersion);
+    abstract @NonNull AbstractMessageProxy<T, C> externalizableProxy(@NonNull ABIVersion reqVersion);
 
     protected final Object writeReplace() {
         return externalizableProxy(version);
index 5c8df78..093a3f1 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -27,16 +28,16 @@ import org.opendaylight.yangtools.concepts.WritableIdentifier;
 @Beta
 public abstract class Request<T extends WritableIdentifier, C extends Request<T, C>> extends Message<T, C> {
     private static final long serialVersionUID = 1L;
-    private final ActorRef replyTo;
+    private final @NonNull ActorRef replyTo;
 
-    protected Request(@Nonnull final T target, final long sequence, @Nonnull final ActorRef replyTo) {
+    protected Request(final @NonNull T target, final long sequence, final @NonNull ActorRef replyTo) {
         super(target, sequence);
-        this.replyTo = Preconditions.checkNotNull(replyTo);
+        this.replyTo = requireNonNull(replyTo);
     }
 
-    protected Request(@Nonnull final C request, @Nonnull final ABIVersion version) {
+    protected Request(final @NonNull C request, final @NonNull ABIVersion version) {
         super(request, version);
-        this.replyTo = Preconditions.checkNotNull(request.getReplyTo());
+        this.replyTo = requireNonNull(request.getReplyTo());
     }
 
     /**
@@ -44,8 +45,7 @@ public abstract class Request<T extends WritableIdentifier, C extends Request<T,
      *
      * @return Original requestor
      */
-    @Nonnull
-    public final ActorRef getReplyTo() {
+    public final @NonNull ActorRef getReplyTo() {
         return replyTo;
     }
 
@@ -55,8 +55,7 @@ public abstract class Request<T extends WritableIdentifier, C extends Request<T,
      * @param cause Failure cause
      * @return {@link RequestFailure} corresponding to this request
      */
-    @Nonnull
-    public abstract RequestFailure<T, ?> toRequestFailure(@Nonnull RequestException cause);
+    public abstract @NonNull RequestFailure<T, ?> toRequestFailure(@NonNull RequestException cause);
 
     @Override
     protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
@@ -64,5 +63,5 @@ public abstract class Request<T extends WritableIdentifier, C extends Request<T,
     }
 
     @Override
-    protected abstract AbstractRequestProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+    protected abstract AbstractRequestProxy<T, C> externalizableProxy(ABIVersion version);
 }
index 4f2a058..7267ede 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A failure cause behind a {@link RequestFailure} to process a {@link Request}.
@@ -20,12 +21,12 @@ import javax.annotation.Nonnull;
 public abstract class RequestException extends Exception {
     private static final long serialVersionUID = 1L;
 
-    protected RequestException(@Nonnull final String message) {
-        super(Preconditions.checkNotNull(message));
+    protected RequestException(final @NonNull String message) {
+        super(requireNonNull(message));
     }
 
-    protected RequestException(@Nonnull final String message, @Nonnull final Throwable cause) {
-        super(Preconditions.checkNotNull(message), Preconditions.checkNotNull(cause));
+    protected RequestException(final @NonNull String message, final @NonNull Throwable cause) {
+        super(requireNonNull(message), requireNonNull(cause));
     }
 
     public abstract boolean isRetriable();
index 13eb4bc..db5a15b 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -26,16 +27,17 @@ import org.opendaylight.yangtools.concepts.WritableIdentifier;
 public abstract class RequestFailure<T extends WritableIdentifier, C extends RequestFailure<T, C>>
         extends Response<T, C> {
     private static final long serialVersionUID = 1L;
-    private final RequestException cause;
 
-    protected RequestFailure(@Nonnull final C failure, @Nonnull final ABIVersion version) {
+    private final @NonNull RequestException cause;
+
+    protected RequestFailure(final @NonNull C failure, final @NonNull ABIVersion version) {
         super(failure, version);
-        this.cause = Preconditions.checkNotNull(failure.getCause());
+        this.cause = requireNonNull(failure.getCause());
     }
 
-    protected RequestFailure(@Nonnull final T target, final long sequence, @Nonnull final RequestException cause) {
+    protected RequestFailure(final @NonNull T target, final long sequence, final @NonNull RequestException cause) {
         super(target, sequence);
-        this.cause = Preconditions.checkNotNull(cause);
+        this.cause = requireNonNull(cause);
     }
 
     /**
@@ -43,8 +45,7 @@ public abstract class RequestFailure<T extends WritableIdentifier, C extends Req
      *
      * @return Failure cause.
      */
-    @Nonnull
-    public final RequestException getCause() {
+    public final @NonNull RequestException getCause() {
         return cause;
     }
 
@@ -64,5 +65,5 @@ public abstract class RequestFailure<T extends WritableIdentifier, C extends Req
     }
 
     @Override
-    protected abstract AbstractRequestFailureProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+    protected abstract AbstractRequestFailureProxy<T, C> externalizableProxy(ABIVersion version);
 }
index 65d4318..9b60d21 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.access.concepts;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -24,14 +24,14 @@ public abstract class RequestSuccess<T extends WritableIdentifier, C extends Req
         Response<T, C> {
     private static final long serialVersionUID = 1L;
 
-    protected RequestSuccess(@Nonnull final C success, @Nonnull final ABIVersion version) {
+    protected RequestSuccess(final @NonNull C success,  final @NonNull ABIVersion version) {
         super(success, version);
     }
 
-    protected RequestSuccess(@Nonnull final T target, final long sequence) {
+    protected RequestSuccess(final @NonNull T target, final long sequence) {
         super(target, sequence);
     }
 
     @Override
-    protected abstract AbstractSuccessProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+    protected abstract AbstractSuccessProxy<T, C> externalizableProxy(ABIVersion version);
 }
index cc6188b..f733a9e 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.access.concepts;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -26,14 +26,14 @@ import org.opendaylight.yangtools.concepts.WritableIdentifier;
 public abstract class Response<T extends WritableIdentifier, C extends Response<T, C>> extends Message<T, C> {
     private static final long serialVersionUID = 1L;
 
-    Response(@Nonnull final T target, final long sequence) {
+    Response(final @NonNull T target, final long sequence) {
         super(target, sequence);
     }
 
-    Response(@Nonnull final C response, @Nonnull final ABIVersion version) {
+    Response(final @NonNull C response, final @NonNull ABIVersion version) {
         super(response, version);
     }
 
     @Override
-    abstract AbstractResponseProxy<T, C> externalizableProxy(@Nonnull ABIVersion version);
+    abstract AbstractResponseProxy<T, C> externalizableProxy(ABIVersion version);
 }
index 5f96074..8fa0b62 100644 (file)
@@ -7,15 +7,16 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 import org.opendaylight.yangtools.concepts.WritableObjects;
 
@@ -39,7 +40,7 @@ public final class TransactionIdentifier implements WritableIdentifier {
         }
 
         Proxy(final LocalHistoryIdentifier historyId, final long transactionId) {
-            this.historyId = Preconditions.checkNotNull(historyId);
+            this.historyId = requireNonNull(historyId);
             this.transactionId = transactionId;
         }
 
@@ -65,8 +66,8 @@ public final class TransactionIdentifier implements WritableIdentifier {
     private final long transactionId;
     private String shortString;
 
-    public TransactionIdentifier(@Nonnull final LocalHistoryIdentifier historyId, final long transactionId) {
-        this.historyId = Preconditions.checkNotNull(historyId);
+    public TransactionIdentifier(final @NonNull LocalHistoryIdentifier historyId, final long transactionId) {
+        this.historyId = requireNonNull(historyId);
         this.transactionId = transactionId;
     }
 
index 2f56dd4..733c3c7 100644 (file)
@@ -7,10 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.concepts;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.DataInput;
 import java.io.IOException;
-import javax.annotation.Nonnull;
-import org.junit.Assert;
 import org.opendaylight.controller.cluster.access.ABIVersion;
 import org.opendaylight.yangtools.concepts.WritableIdentifier;
 
@@ -25,11 +25,11 @@ public class FailureEnvelopeTest extends AbstractEnvelopeTest<FailureEnvelope> {
 
     @Override
     protected void doAdditionalAssertions(final FailureEnvelope envelope, final FailureEnvelope resolvedObject) {
-        Assert.assertEquals(envelope.getExecutionTimeNanos(), resolvedObject.getExecutionTimeNanos());
+        assertEquals(envelope.getExecutionTimeNanos(), resolvedObject.getExecutionTimeNanos());
         final RequestException expectedCause = envelope.getMessage().getCause();
         final RequestException actualCause = resolvedObject.getMessage().getCause();
-        Assert.assertEquals(expectedCause.getMessage(), actualCause.getMessage());
-        Assert.assertEquals(expectedCause.isRetriable(), actualCause.isRetriable());
+        assertEquals(expectedCause.getMessage(), actualCause.getMessage());
+        assertEquals(expectedCause.isRetriable(), actualCause.isRetriable());
     }
 
     private static class MockRequestFailureProxy extends AbstractRequestFailureProxy<WritableIdentifier, MockFailure> {
@@ -43,16 +43,14 @@ public class FailureEnvelopeTest extends AbstractEnvelopeTest<FailureEnvelope> {
             super(mockFailure);
         }
 
-        @Nonnull
         @Override
-        protected MockFailure createFailure(@Nonnull final WritableIdentifier target, final long sequence,
-                                            @Nonnull final RequestException failureCause) {
+        protected MockFailure createFailure(final WritableIdentifier target, final long sequence,
+                                            final RequestException failureCause) {
             return new MockFailure(target, failureCause, sequence);
         }
 
-        @Nonnull
         @Override
-        protected WritableIdentifier readTarget(@Nonnull final DataInput in) throws IOException {
+        protected WritableIdentifier readTarget(final DataInput in) throws IOException {
             return TransactionIdentifier.readFrom(in);
         }
 
@@ -75,7 +73,5 @@ public class FailureEnvelopeTest extends AbstractEnvelopeTest<FailureEnvelope> {
         protected MockFailure cloneAsVersion(final ABIVersion version) {
             return this;
         }
-
     }
-
 }
index f80ae7c..4188a41 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Base behavior attached to {@link AbstractClientActor}.
@@ -22,11 +23,11 @@ import javax.annotation.Nullable;
  */
 @Beta
 public abstract class AbstractClientActorBehavior<C extends AbstractClientActorContext> implements AutoCloseable {
-    private final C context;
+    private final @NonNull C context;
 
-    AbstractClientActorBehavior(@Nonnull final C context) {
+    AbstractClientActorBehavior(final @NonNull C context) {
         // Hidden to prevent outside subclasses. Users instantiated this via ClientActorBehavior
-        this.context = Preconditions.checkNotNull(context);
+        this.context = requireNonNull(context);
     }
 
     /**
@@ -34,8 +35,7 @@ public abstract class AbstractClientActorBehavior<C extends AbstractClientActorC
      *
      * @return A client actor context instance.
      */
-    @Nonnull
-    protected final C context() {
+    protected final @NonNull C context() {
         return context;
     }
 
@@ -45,8 +45,7 @@ public abstract class AbstractClientActorBehavior<C extends AbstractClientActorC
      *
      * @return Persistence identifier
      */
-    @Nonnull
-    protected final String persistenceId() {
+    protected final @NonNull String persistenceId() {
         return context.persistenceId();
     }
 
@@ -55,8 +54,7 @@ public abstract class AbstractClientActorBehavior<C extends AbstractClientActorC
      *
      * @return Actor associated with this behavior
      */
-    @Nonnull
-    public final ActorRef self() {
+    public final @NonNull ActorRef self() {
         return context.self();
     }
 
@@ -70,8 +68,7 @@ public abstract class AbstractClientActorBehavior<C extends AbstractClientActorC
      * @param command Command message
      * @return Behavior which should be used with the next message. Return null if this actor should shut down.
      */
-    @Nullable
-    abstract AbstractClientActorBehavior<?> onReceiveCommand(@Nonnull Object command);
+    abstract @Nullable AbstractClientActorBehavior<?> onReceiveCommand(@NonNull Object command);
 
     /**
      * Implementation-internal method for handling an incoming recovery message coming from persistence.
@@ -79,6 +76,5 @@ public abstract class AbstractClientActorBehavior<C extends AbstractClientActorC
      * @param recover Recover message
      * @return Behavior which should be used with the next message. Return null if this actor should shut down.
      */
-    @Nullable
-    abstract AbstractClientActorBehavior<?> onReceiveRecover(@Nonnull Object recover);
+    abstract @Nullable AbstractClientActorBehavior<?> onReceiveRecover(@NonNull Object recover);
 }
index 9f0bcbc..a09d06c 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Mutable;
 
 /**
@@ -19,22 +20,20 @@ import org.opendaylight.yangtools.concepts.Mutable;
  * @author Robert Varga
  */
 abstract class AbstractClientActorContext implements Mutable {
-    private final String persistenceId;
-    private final ActorRef self;
+    private final @NonNull String persistenceId;
+    private final @NonNull ActorRef self;
 
-    AbstractClientActorContext(@Nonnull final ActorRef self, @Nonnull final String persistenceId) {
-        this.persistenceId = Preconditions.checkNotNull(persistenceId);
-        this.self = Preconditions.checkNotNull(self);
+    AbstractClientActorContext(final @NonNull ActorRef self, final @NonNull String persistenceId) {
+        this.persistenceId = requireNonNull(persistenceId);
+        this.self = requireNonNull(self);
     }
 
     // TODO: rename this to logContext()
-    @Nonnull
-    final String persistenceId() {
+    final @NonNull String persistenceId() {
         return persistenceId;
     }
 
-    @Nonnull
-    public final ActorRef self() {
+    public final @NonNull ActorRef self() {
         return self;
     }
 }
index c32f7b2..03d4691 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collection;
 import java.util.Optional;
@@ -20,9 +21,9 @@ import java.util.concurrent.TimeoutException;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Consumer;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.NotThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.Request;
 import org.opendaylight.controller.cluster.access.concepts.RequestException;
 import org.opendaylight.controller.cluster.access.concepts.Response;
@@ -77,7 +78,7 @@ public abstract class AbstractClientConnection<T extends BackendInfo> {
     private final ClientActorContext context;
     @GuardedBy("lock")
     private final TransmitQueue queue;
-    private final Long cookie;
+    private final @NonNull Long cookie;
     private final String backendName;
 
     @GuardedBy("lock")
@@ -93,10 +94,10 @@ public abstract class AbstractClientConnection<T extends BackendInfo> {
     // Private constructor to avoid code duplication.
     private AbstractClientConnection(final AbstractClientConnection<T> oldConn, final TransmitQueue newQueue,
             final String backendName) {
-        this.context = Preconditions.checkNotNull(oldConn.context);
-        this.cookie = Preconditions.checkNotNull(oldConn.cookie);
-        this.backendName = Preconditions.checkNotNull(backendName);
-        this.queue = Preconditions.checkNotNull(newQueue);
+        this.context = requireNonNull(oldConn.context);
+        this.cookie = requireNonNull(oldConn.cookie);
+        this.backendName = requireNonNull(backendName);
+        this.queue = requireNonNull(newQueue);
         // Will be updated in finishReplay if needed.
         this.lastReceivedTicks = oldConn.lastReceivedTicks;
     }
@@ -105,9 +106,9 @@ public abstract class AbstractClientConnection<T extends BackendInfo> {
     // Do not allow subclassing outside of this package
     AbstractClientConnection(final ClientActorContext context, final Long cookie, final String backendName,
             final int queueDepth) {
-        this.context = Preconditions.checkNotNull(context);
-        this.cookie = Preconditions.checkNotNull(cookie);
-        this.backendName = Preconditions.checkNotNull(backendName);
+        this.context = requireNonNull(context);
+        this.cookie = requireNonNull(cookie);
+        this.backendName = requireNonNull(backendName);
         this.queue = new TransmitQueue.Halted(queueDepth);
         this.lastReceivedTicks = currentTime();
     }
@@ -123,14 +124,14 @@ public abstract class AbstractClientConnection<T extends BackendInfo> {
     AbstractClientConnection(final AbstractClientConnection<T> oldConn, final T newBackend,
             final int queueDepth) {
         this(oldConn, new TransmitQueue.Transmitting(oldConn.queue, queueDepth, newBackend, oldConn.currentTime(),
-                Preconditions.checkNotNull(oldConn.context).messageSlicer()), newBackend.getName());
+            requireNonNull(oldConn.context).messageSlicer()), newBackend.getName());
     }
 
     public final ClientActorContext context() {
         return context;
     }
 
-    public final @Nonnull Long cookie() {
+    public final @NonNull Long cookie() {
         return cookie;
     }
 
index fc633ad..5c5cda5 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.cluster.access.client;
 import akka.actor.ActorRef;
 import java.util.concurrent.CompletionStage;
 import java.util.function.Consumer;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.Registration;
 
 /**
@@ -35,8 +35,7 @@ public abstract class BackendInfoResolver<T extends BackendInfo> implements Auto
      * @param cookie Backend cookie
      * @return A {@link CompletionStage} resulting in information about the backend
      */
-    @Nonnull
-    public abstract CompletionStage<? extends T> getBackendInfo(@Nonnull Long cookie);
+    public abstract @NonNull CompletionStage<? extends T> getBackendInfo(@NonNull Long cookie);
 
     /**
      * Request re-resolution of a particular backend identified by a cookie, indicating a particular information as
@@ -46,8 +45,8 @@ public abstract class BackendInfoResolver<T extends BackendInfo> implements Auto
      * @param staleInfo Stale backend information
      * @return A {@link CompletionStage} resulting in information about the backend
      */
-    @Nonnull
-    public abstract CompletionStage<? extends T> refreshBackendInfo(@Nonnull Long cookie, @Nonnull T staleInfo);
+    public abstract @NonNull CompletionStage<? extends T> refreshBackendInfo(@NonNull Long cookie,
+            @NonNull T staleInfo);
 
     /**
      * Registers a callback to be notified when BackendInfo that may have been previously obtained is now stale and
@@ -56,11 +55,9 @@ public abstract class BackendInfoResolver<T extends BackendInfo> implements Auto
      * @param callback the callback that takes the backend cookie whose BackendInfo is now stale.
      * @return a Registration
      */
-    @Nonnull
-    public abstract Registration notifyWhenBackendInfoIsStale(Consumer<Long> callback);
+    public abstract @NonNull Registration notifyWhenBackendInfoIsStale(Consumer<Long> callback);
 
-    @Nonnull
-    public abstract String resolveCookieName(Long cookie);
+    public abstract @NonNull String resolveCookieName(Long cookie);
 
     @Override
     public void close() {
index 6ede15b..53c6bd9 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Stopwatch;
 import com.google.common.base.Verify;
 import java.util.Collection;
@@ -17,9 +18,9 @@ import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.commands.NotLeaderException;
 import org.opendaylight.controller.cluster.access.commands.OutOfSequenceEnvelopeException;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
@@ -61,7 +62,7 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
          * @param enqueuedEntries Previously-enqueued entries
          * @return A {@link ReconnectForwarder} to handle any straggler messages which arrive after this method returns.
          */
-        @Nonnull ReconnectForwarder finishReconnect(@Nonnull Collection<ConnectionEntry> enqueuedEntries);
+        @NonNull ReconnectForwarder finishReconnect(@NonNull Collection<ConnectionEntry> enqueuedEntries);
     }
 
     private static final Logger LOG = LoggerFactory.getLogger(ClientActorBehavior.class);
@@ -86,10 +87,10 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
     private final MessageAssembler responseMessageAssembler;
     private final Registration staleBackendInfoReg;
 
-    protected ClientActorBehavior(@Nonnull final ClientActorContext context,
-            @Nonnull final BackendInfoResolver<T> resolver) {
+    protected ClientActorBehavior(final @NonNull ClientActorContext context,
+            final @NonNull BackendInfoResolver<T> resolver) {
         super(context);
-        this.resolver = Preconditions.checkNotNull(resolver);
+        this.resolver = requireNonNull(resolver);
 
         final ClientActorConfig config = context.config();
         responseMessageAssembler = MessageAssembler.builder().logContext(persistenceId())
@@ -110,7 +111,6 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
     }
 
     @Override
-    @Nonnull
     public final ClientIdentifier getIdentifier() {
         return context().getIdentifier();
     }
@@ -275,7 +275,7 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
      *
      * @param cause Failure cause
      */
-    protected abstract void haltClient(@Nonnull Throwable cause);
+    protected abstract void haltClient(@NonNull Throwable cause);
 
     /**
      * Override this method to handle any command which is not handled by the base behavior.
@@ -283,15 +283,14 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
      * @param command the command to process
      * @return Next behavior to use, null if this actor should shut down.
      */
-    @Nullable
-    protected abstract ClientActorBehavior<T> onCommand(@Nonnull Object command);
+    protected abstract @Nullable ClientActorBehavior<T> onCommand(@NonNull Object command);
 
     /**
      * Override this method to provide a backend resolver instance.
      *
      * @return a backend resolver instance
      */
-    protected final @Nonnull BackendInfoResolver<T> resolver() {
+    protected final @NonNull BackendInfoResolver<T> resolver() {
         return resolver;
     }
 
@@ -303,7 +302,7 @@ public abstract class ClientActorBehavior<T extends BackendInfo> extends
      * @return ConnectionConnectCohort which will be used to complete the process of bringing the connection up.
      */
     @GuardedBy("connectionsLock")
-    @Nonnull protected abstract ConnectionConnectCohort connectionUp(@Nonnull ConnectedClientConnection<T> newConn);
+    protected abstract @NonNull ConnectionConnectCohort connectionUp(@NonNull ConnectedClientConnection<T> newConn);
 
     private void backendConnectFinished(final Long shard, final AbstractClientConnection<T> oldConn,
             final T backend, final Throwable failure) {
index 7e392af..f85e8e2 100644 (file)
@@ -7,16 +7,17 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.Cancellable;
 import akka.actor.Scheduler;
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Ticker;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.ThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
 import org.opendaylight.controller.cluster.common.actor.Dispatchers;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
@@ -49,11 +50,11 @@ public class ClientActorContext extends AbstractClientActorContext implements Id
     ClientActorContext(final ActorRef self, final String persistenceId, final ActorSystem system,
             final ClientIdentifier identifier, final ClientActorConfig config) {
         super(self, persistenceId);
-        this.identifier = Preconditions.checkNotNull(identifier);
-        this.scheduler = Preconditions.checkNotNull(system).scheduler();
+        this.identifier = requireNonNull(identifier);
+        this.scheduler = requireNonNull(system).scheduler();
         this.executionContext = system.dispatcher();
         this.dispatchers = new Dispatchers(system.dispatchers());
-        this.config = Preconditions.checkNotNull(config);
+        this.config = requireNonNull(config);
 
         messageSlicer = MessageSlicer.builder().messageSliceSize(config.getMaximumMessageSliceSize())
             .logContext(persistenceId).expireStateAfterInactivity(config.getRequestTimeout(), TimeUnit.NANOSECONDS)
@@ -62,23 +63,19 @@ public class ClientActorContext extends AbstractClientActorContext implements Id
     }
 
     @Override
-    @Nonnull
     public ClientIdentifier getIdentifier() {
         return identifier;
     }
 
-    @Nonnull
-    public ClientActorConfig config() {
+    public @NonNull ClientActorConfig config() {
         return config;
     }
 
-    @Nonnull
-    public Dispatchers dispatchers() {
+    public @NonNull Dispatchers dispatchers() {
         return dispatchers;
     }
 
-    @Nonnull
-    public MessageSlicer messageSlicer() {
+    public @NonNull MessageSlicer messageSlicer() {
         return messageSlicer;
     }
 
@@ -89,8 +86,7 @@ public class ClientActorContext extends AbstractClientActorContext implements Id
      *
      * @return Client actor time source
      */
-    @Nonnull
-    public Ticker ticker() {
+    public @NonNull Ticker ticker() {
         return Ticker.systemTicker();
     }
 
@@ -100,13 +96,13 @@ public class ClientActorContext extends AbstractClientActorContext implements Id
      * @param command Block of code which needs to be execute
      * @param <T> BackendInfo type
      */
-    public <T extends BackendInfo> void executeInActor(@Nonnull final InternalCommand<T> command) {
-        self().tell(Preconditions.checkNotNull(command), ActorRef.noSender());
+    public <T extends BackendInfo> void executeInActor(final @NonNull InternalCommand<T> command) {
+        self().tell(requireNonNull(command), ActorRef.noSender());
     }
 
-    public <T extends BackendInfo> Cancellable executeInActor(@Nonnull final InternalCommand<T> command,
+    public <T extends BackendInfo> Cancellable executeInActor(final @NonNull InternalCommand<T> command,
             final FiniteDuration delay) {
-        return scheduler.scheduleOnce(Preconditions.checkNotNull(delay), self(), Preconditions.checkNotNull(command),
+        return scheduler.scheduleOnce(requireNonNull(delay), self(), requireNonNull(command),
             executionContext, ActorRef.noSender());
     }
 }
index c841f13..0873552 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.cluster.access.client;
 
 import akka.dispatch.ControlMessage;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * This interface is used to pass the unit of work via the actors mailbox. The command can alter behavior of the actor
@@ -25,5 +25,5 @@ public interface InternalCommand<T extends BackendInfo> extends ControlMessage {
      * @param currentBehavior Current Behavior
      * @return Next behavior to use in the client actor
      */
-    @Nullable ClientActorBehavior<T> execute(@Nonnull ClientActorBehavior<T> currentBehavior);
+    @Nullable ClientActorBehavior<T> execute(@NonNull ClientActorBehavior<T> currentBehavior);
 }
index 90af8cb..e5a949a 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.controller.cluster.access.client;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.Response;
 
 @FunctionalInterface
@@ -19,5 +19,5 @@ interface RequestCallback {
      * @param response Response to the request
      * @return Next client actor behavior
      */
-    @Nullable ClientActorBehavior<?> complete(@Nonnull Response<?, ?> response);
+    @Nullable ClientActorBehavior<?> complete(@NonNull Response<?, ?> response);
 }
index 0d54235..5aa88a2 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.dom.api;
 
 import com.google.common.annotations.Beta;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer;
 
@@ -35,6 +35,6 @@ public interface CDSDataTreeProducer extends DOMDataTreeProducer {
      *         are violated, for example if this producer is bound and this thread
      *         is currently not executing from a listener context.
      */
-    @Nonnull CDSShardAccess getShardAccess(@Nonnull DOMDataTreeIdentifier subtree);
+    @NonNull CDSShardAccess getShardAccess(@NonNull DOMDataTreeIdentifier subtree);
 }
 
index d08b99a..2051e21 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.dom.api;
 
 import com.google.common.annotations.Beta;
 import java.util.concurrent.CompletionStage;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 
 /**
@@ -27,7 +27,7 @@ public interface CDSShardAccess {
      * @throws IllegalStateException if the {@link CDSDataTreeProducer} from which the associated
      *         {@link CDSDataTreeProducer} is no longer valid.
      */
-    @Nonnull DOMDataTreeIdentifier getShardIdentifier();
+    @NonNull DOMDataTreeIdentifier getShardIdentifier();
 
     /**
      * Return the shard leader location relative to the local node.
@@ -36,7 +36,7 @@ public interface CDSShardAccess {
      * @throws IllegalStateException if the {@link CDSDataTreeProducer} from which the associated
      *         {@link CDSDataTreeProducer} is no longer valid.
      */
-    @Nonnull LeaderLocation getLeaderLocation();
+    @NonNull LeaderLocation getLeaderLocation();
 
     /**
      * Request the shard leader to be moved to the local node. The request will be evaluated against shard state and
@@ -56,7 +56,7 @@ public interface CDSShardAccess {
      * @throws IllegalStateException if the {@link CDSDataTreeProducer} from which the associated
      *         {@link CDSDataTreeProducer} is no longer valid.
      */
-    @Nonnull CompletionStage<Void> makeLeaderLocal();
+    @NonNull CompletionStage<Void> makeLeaderLocal();
 
     /**
      * Register a listener to shard location changes. Each listener object can be registered at most once.
@@ -68,6 +68,6 @@ public interface CDSShardAccess {
      *         {@link CDSDataTreeProducer} is no longer valid.
      * @throws NullPointerException if listener is null.
      */
-    @Nonnull <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L> registerLeaderLocationListener(
-            @Nonnull L listener);
+    @NonNull <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L> registerLeaderLocationListener(
+            @NonNull L listener);
 }
index 489539a..4f5fd4e 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.dom.api;
 
 import com.google.common.annotations.Beta;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Listener for shard leader location changes.
@@ -23,5 +23,5 @@ public interface LeaderLocationListener extends EventListener {
      *
      * @param location Current leader location as known by the local node.
      */
-    void onLeaderLocationChanged(@Nonnull LeaderLocation location);
+    void onLeaderLocationChanged(@NonNull LeaderLocation location);
 }
index 30e81c4..f96daaa 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
+import static java.util.Objects.requireNonNull;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.Objects;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Implementation of {@link CloseTracked} which can be used as a field in
@@ -31,6 +32,7 @@ public class CloseTrackedTrait<T extends CloseTracked<T>> implements CloseTracke
     private final CloseTrackedRegistry<T> closeTrackedRegistry;
     private final CloseTracked<T> realCloseTracked;
 
+    @SuppressFBWarnings(value = "NP_STORE_INTO_NONNULL_FIELD", justification = "SpotBugs and JDT annotations")
     public CloseTrackedTrait(CloseTrackedRegistry<T> transactionChainRegistry, CloseTracked<T> realCloseTracked) {
         if (transactionChainRegistry.isDebugContextEnabled()) {
             // NB: We're NOT doing the (expensive) getStackTrace() here just yet (only below)
@@ -39,13 +41,12 @@ public class CloseTrackedTrait<T extends CloseTracked<T>> implements CloseTracke
         } else {
             this.allocationContext = null;
         }
-        this.realCloseTracked = Objects.requireNonNull(realCloseTracked, "realCloseTracked");
-        this.closeTrackedRegistry = Objects.requireNonNull(transactionChainRegistry, "transactionChainRegistry");
+        this.realCloseTracked = requireNonNull(realCloseTracked, "realCloseTracked");
+        this.closeTrackedRegistry = requireNonNull(transactionChainRegistry, "transactionChainRegistry");
         this.closeTrackedRegistry.add(this);
     }
 
     @Override
-    @Nullable
     @SuppressFBWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS")
     public StackTraceElement[] getAllocationContextStackTrace() {
         return allocationContext != null ? allocationContext.getStackTrace() : null;
index acd9f91..a8f21f9 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.controller.md.sal.trace.dom.impl;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableSet;
 import com.google.common.util.concurrent.FluentFuture;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 import java.util.Set;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.mdsal.common.api.CommitInfo;
@@ -27,8 +27,8 @@ abstract class AbstractTracingWriteTransaction implements DOMDataWriteTransactio
     private final List<String> logs = new ArrayList<>();
 
     AbstractTracingWriteTransaction(DOMDataWriteTransaction delegate, TracingBroker tracingBroker) {
-        this.delegate = Objects.requireNonNull(delegate);
-        this.tracingBroker = Objects.requireNonNull(tracingBroker);
+        this.delegate = requireNonNull(delegate);
+        this.tracingBroker = requireNonNull(tracingBroker);
         recordOp(null, null, "instantiate", null);
     }
 
@@ -114,7 +114,6 @@ abstract class AbstractTracingWriteTransaction implements DOMDataWriteTransactio
     }
 
     @Override
-    @Nonnull
     public Object getIdentifier() {
         return delegate.getIdentifier();
     }
index 7103a00..8291a72 100644 (file)
@@ -16,7 +16,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
@@ -319,7 +318,6 @@ public class TracingBroker implements TracingDOMDataBroker {
         return new TracingReadOnlyTransaction(delegate.newReadOnlyTransaction(), readOnlyTransactionsRegistry);
     }
 
-    @Nonnull
     @Override
     public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
         Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> res = delegate.getSupportedExtensions();
@@ -331,10 +329,9 @@ public class TracingBroker implements TracingDOMDataBroker {
         res = new HashMap<>(res);
 
         res.put(DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
-            @Nonnull
             @Override
             public <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
-                    @Nonnull DOMDataTreeIdentifier domDataTreeIdentifier, @Nonnull L listener) {
+                    DOMDataTreeIdentifier domDataTreeIdentifier, L listener) {
                 if (isRegistrationWatched(domDataTreeIdentifier.getRootIdentifier(),
                         domDataTreeIdentifier.getDatastoreType())) {
                     LOG.warn("{} registration (registerDataTreeChangeListener) for {} from {}.",
index f2ac8d5..6c9e17b 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.messagebus.app.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -19,7 +20,6 @@ import java.util.UUID;
 import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.ExecutionException;
 import java.util.regex.Pattern;
-import javax.annotation.Nonnull;
 import org.opendaylight.mdsal.binding.api.DataObjectModification;
 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
@@ -64,8 +64,8 @@ public final class EventSourceTopic implements DataTreeChangeListener<Node>, Aut
 
     private EventSourceTopic(final NotificationPattern notificationPattern, final String nodeIdRegexPattern,
             final EventSourceService sourceService) {
-        this.notificationPattern = Preconditions.checkNotNull(notificationPattern);
-        this.sourceService = Preconditions.checkNotNull(sourceService);
+        this.notificationPattern = requireNonNull(notificationPattern);
+        this.sourceService = requireNonNull(sourceService);
         this.nodeIdPattern = Pattern.compile(nodeIdRegexPattern);
         this.topicId = new TopicId(getUUIDIdent());
         this.listenerRegistration = null;
@@ -122,7 +122,7 @@ public final class EventSourceTopic implements DataTreeChangeListener<Node>, Aut
 
         Futures.addCallback(future, new FutureCallback<Optional<Topology>>() {
             @Override
-            public void onSuccess(@Nonnull final Optional<Topology> data) {
+            public void onSuccess(final Optional<Topology> data) {
                 if (data.isPresent()) {
                     final List<Node> nodes = data.get().getNode();
                     if (nodes != null) {
index a1916f1..a2bcc8a 100644 (file)
@@ -18,7 +18,6 @@ import java.io.OutputStream;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import org.apache.commons.lang3.SerializationUtils;
 import org.opendaylight.controller.cluster.example.messages.KeyValue;
 import org.opendaylight.controller.cluster.example.messages.KeyValueSaved;
@@ -50,10 +49,9 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
     }
 
     private final Map<String, String> state = new HashMap<>();
-
-    private long persistIdentifier = 1;
     private final Optional<ActorRef> roleChangeNotifier;
 
+    private long persistIdentifier = 1;
 
     public ExampleActor(String id, Map<String, String> peerAddresses,
         Optional<ConfigParams> configParams) {
@@ -155,16 +153,17 @@ public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort,
         }
     }
 
-    @Override protected void onStateChanged() {
+    @Override
+    protected void onStateChanged() {
 
     }
 
-    @Override public String persistenceId() {
+    @Override
+    public String persistenceId() {
         return getId();
     }
 
     @Override
-    @Nonnull
     protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
         return this;
     }
index 8d6b965..fb571f1 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
 import scala.concurrent.duration.FiniteDuration;
 
@@ -98,16 +98,14 @@ public interface ConfigParams {
      *
      * @return an instance of RaftPolicy, if set, or an instance of the DefaultRaftPolicy.
      */
-    @Nonnull
-    RaftPolicy getRaftPolicy();
+    @NonNull RaftPolicy getRaftPolicy();
 
     /**
      * Returns the PeerAddressResolver.
      *
      * @return the PeerAddressResolver instance.
      */
-    @Nonnull
-    PeerAddressResolver getPeerAddressResolver();
+    @NonNull PeerAddressResolver getPeerAddressResolver();
 
     /**
      * Returns the custom RaftPolicy class name.
@@ -121,8 +119,7 @@ public interface ConfigParams {
      *
      * @return the directory in which to create temp files.
      */
-    @Nonnull
-    String getTempFileDirectory();
+    @NonNull String getTempFileDirectory();
 
     /**
      * Returns the threshold in terms of number of bytes when streaming data before it should switch from storing in
index 932069e..5372804 100644 (file)
@@ -7,12 +7,14 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Strings;
 import com.google.common.base.Supplier;
 import com.google.common.base.Suppliers;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.policy.DefaultRaftPolicy;
 import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
 import org.slf4j.Logger;
@@ -192,8 +194,8 @@ public class DefaultConfigParamsImpl implements ConfigParams {
         return peerAddressResolver;
     }
 
-    public void setPeerAddressResolver(@Nonnull final PeerAddressResolver peerAddressResolver) {
-        this.peerAddressResolver = Preconditions.checkNotNull(peerAddressResolver);
+    public void setPeerAddressResolver(final @NonNull PeerAddressResolver peerAddressResolver) {
+        this.peerAddressResolver = requireNonNull(peerAddressResolver);
     }
 
     @Override
@@ -202,7 +204,7 @@ public class DefaultConfigParamsImpl implements ConfigParams {
     }
 
     public void setSyncIndexThreshold(final long syncIndexThreshold) {
-        Preconditions.checkArgument(syncIndexThreshold >= 0);
+        checkArgument(syncIndexThreshold >= 0);
         this.syncIndexThreshold = syncIndexThreshold;
     }
 
index 264f7a5..61aafef 100644 (file)
@@ -5,10 +5,9 @@
  * 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.controller.cluster.raft;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * ElectionTerm contains information about a RaftActors election term.
@@ -33,8 +32,7 @@ public interface ElectionTerm {
      *
      * @return candidate id that received the vote or null if no candidate was voted for.
      */
-    @Nullable
-    String getVotedFor();
+    @Nullable String getVotedFor();
 
     /**
      * This method updates the in-memory election term state. This method should be called when recovering election
index ca3de59..a5f2499 100644 (file)
@@ -5,15 +5,16 @@
  * 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.controller.cluster.raft;
 
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Stopwatch;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.behaviors.LeaderInstallSnapshotState;
 
 /**
@@ -65,7 +66,7 @@ public final class FollowerLogInformation {
         this.nextIndex = context.getCommitIndex();
         this.matchIndex = matchIndex;
         this.context = context;
-        this.peerInfo = Preconditions.checkNotNull(peerInfo);
+        this.peerInfo = requireNonNull(peerInfo);
     }
 
     /**
@@ -301,8 +302,7 @@ public final class FollowerLogInformation {
      *
      * @return the LeaderInstallSnapshotState if a snapshot install is in progress, null otherwise.
      */
-    @Nullable
-    public LeaderInstallSnapshotState getInstallSnapshotState() {
+    public @Nullable LeaderInstallSnapshotState getInstallSnapshotState() {
         return installSnapshotState;
     }
 
@@ -311,9 +311,9 @@ public final class FollowerLogInformation {
      *
      * @param state the LeaderInstallSnapshotState
      */
-    public void setLeaderInstallSnapshotState(@Nonnull final LeaderInstallSnapshotState state) {
+    public void setLeaderInstallSnapshotState(final @NonNull LeaderInstallSnapshotState state) {
         if (this.installSnapshotState == null) {
-            this.installSnapshotState = Preconditions.checkNotNull(state);
+            this.installSnapshotState = requireNonNull(state);
         }
     }
 
@@ -321,7 +321,7 @@ public final class FollowerLogInformation {
      * Clears the LeaderInstallSnapshotState when an install snapshot is complete.
      */
     public void clearLeaderInstallSnapshotState() {
-        Preconditions.checkState(installSnapshotState != null);
+        checkState(installSnapshotState != null);
         installSnapshotState.close();
         installSnapshotState = null;
     }
@@ -349,8 +349,7 @@ public final class FollowerLogInformation {
         needsLeaderAddress = value;
     }
 
-    @Nullable
-    public String needsLeaderAddress(String leaderId) {
+    public @Nullable String needsLeaderAddress(String leaderId) {
         return needsLeaderAddress ? context.getPeerAddress(leaderId) : null;
     }
 
index c7d8157..ac9be25 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Interface to resolve raft actor peer addresses.
@@ -31,5 +31,6 @@ public interface PeerAddressResolver {
      * @param address the peer's actor's address
      */
     default void setResolved(String peerId, String address) {
+
     }
 }
index 6cbeda6..775ab0c 100755 (executable)
@@ -6,17 +6,17 @@
  * 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.controller.cluster.raft;
 
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.PoisonPill;
 import akka.actor.Status;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
 import com.google.common.collect.Lists;
 import java.util.Collection;
 import java.util.HashMap;
@@ -24,9 +24,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.apache.commons.lang3.time.DurationFormatUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.DelegatingPersistentDataProvider;
 import org.opendaylight.controller.cluster.NonPersistentDataProvider;
@@ -327,7 +327,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     }
 
     private void initiateLeadershipTransfer(final RaftActorLeadershipTransferCohort.OnComplete onComplete,
-            @Nullable final String followerId, final long newLeaderTimeoutInMillis) {
+            final @Nullable String followerId, final long newLeaderTimeoutInMillis) {
         LOG.debug("{}: Initiating leader transfer", persistenceId());
 
         RaftActorLeadershipTransferCohort leadershipTransferInProgress = context.getRaftActorLeadershipTransferCohort();
@@ -814,8 +814,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     /**
      * Returns the RaftActorRecoveryCohort to participate in persistence recovery.
      */
-    @Nonnull
-    protected abstract RaftActorRecoveryCohort getRaftActorRecoveryCohort();
+    protected abstract @NonNull RaftActorRecoveryCohort getRaftActorRecoveryCohort();
 
     /**
      * This method is called when recovery is complete.
@@ -825,8 +824,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
     /**
      * Returns the RaftActorSnapshotCohort to participate in snapshot captures.
      */
-    @Nonnull
-    protected abstract RaftActorSnapshotCohort getRaftActorSnapshotCohort();
+    protected abstract @NonNull RaftActorSnapshotCohort getRaftActorSnapshotCohort();
 
     /**
      * This method will be called by the RaftActor when the state of the
@@ -948,7 +946,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
         @Nullable abstract String getLastLeaderId();
 
-        @Nullable abstract short getLeaderPayloadVersion();
+        abstract short getLeaderPayloadVersion();
     }
 
     /**
@@ -964,7 +962,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
                 final RaftActorBehavior behavior) {
             this.lastValidLeaderId = lastValidLeaderId;
             this.lastLeaderId = lastLeaderId;
-            this.behavior = Preconditions.checkNotNull(behavior);
+            this.behavior = requireNonNull(behavior);
             this.leaderPayloadVersion = behavior.getLeaderPayloadVersion();
         }
 
@@ -1027,7 +1025,7 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor {
 
         BehaviorState capture(final RaftActorBehavior behavior) {
             if (behavior == null) {
-                Verify.verify(lastValidLeaderId == null, "Null behavior with non-null last leader");
+                verify(lastValidLeaderId == null, "Null behavior with non-null last leader");
                 return NULL_BEHAVIOR_STATE;
             }
 
index aed050c..b5f3afd 100644 (file)
@@ -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.controller.cluster.raft;
 
 import akka.actor.ActorRef;
@@ -18,8 +17,8 @@ import java.util.Collection;
 import java.util.Optional;
 import java.util.function.Consumer;
 import java.util.function.LongSupplier;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
@@ -77,8 +76,7 @@ public interface RaftActorContext {
      *
      * @return the ElectionTerm.
      */
-    @Nonnull
-    ElectionTerm getTermInformation();
+    @NonNull ElectionTerm getTermInformation();
 
     /**
      * Returns the index of highest log entry known to be committed.
@@ -114,31 +112,28 @@ public interface RaftActorContext {
      *
      * @param replicatedLog the ReplicatedLog instance.
      */
-    void setReplicatedLog(@Nonnull ReplicatedLog replicatedLog);
+    void setReplicatedLog(@NonNull ReplicatedLog replicatedLog);
 
     /**
      * Returns the ReplicatedLog instance.
      *
      * @return the ReplicatedLog instance.
      */
-    @Nonnull
-    ReplicatedLog getReplicatedLog();
+    @NonNull ReplicatedLog getReplicatedLog();
 
     /**
      * Returns the The ActorSystem associated with this context.
      *
      * @return the ActorSystem.
      */
-    @Nonnull
-    ActorSystem getActorSystem();
+    @NonNull ActorSystem getActorSystem();
 
     /**
      * Returns the logger to be used for logging messages.
      *
      * @return the logger.
      */
-    @Nonnull
-    Logger getLogger();
+    @NonNull Logger getLogger();
 
     /**
      * Gets the address of a peer as a String. This is the same format in which a consumer would provide the address.
@@ -146,8 +141,7 @@ public interface RaftActorContext {
      * @param peerId the id of the peer.
      * @return the address of the peer or null if the address has not yet been resolved.
      */
-    @Nullable
-    String getPeerAddress(String peerId);
+    @Nullable String getPeerAddress(String peerId);
 
     /**
      * Updates the peers and information to match the given ServerConfigurationPayload.
@@ -161,16 +155,14 @@ public interface RaftActorContext {
      *
      * @return list of PeerInfo
      */
-    @Nonnull
-    Collection<PeerInfo> getPeers();
+    @NonNull Collection<PeerInfo> getPeers();
 
     /**
      * Returns the id's for each peer.
      *
      * @return the list of peer id's.
      */
-    @Nonnull
-    Collection<String> getPeerIds();
+    @NonNull Collection<String> getPeerIds();
 
     /**
      * Returns the PeerInfo for the given peer.
@@ -178,8 +170,7 @@ public interface RaftActorContext {
      * @param peerId the id of the peer
      * @return the PeerInfo or null if not found
      */
-    @Nullable
-    PeerInfo getPeerInfo(String peerId);
+    @Nullable PeerInfo getPeerInfo(String peerId);
 
     /**
      * Adds a new peer.
@@ -203,8 +194,7 @@ public interface RaftActorContext {
      * @param peerId the id of the peer.
      * @return the actorSelection corresponding to the peer or null if the address has not yet been resolved.
      */
-    @Nullable
-    ActorSelection getPeerActorSelection(String peerId);
+    @Nullable ActorSelection getPeerActorSelection(String peerId);
 
     /**
      * Sets the address of a peer.
@@ -219,24 +209,21 @@ public interface RaftActorContext {
      *
      * @return the ConfigParams instance.
      */
-    @Nonnull
-    ConfigParams getConfigParams();
+    @NonNull ConfigParams getConfigParams();
 
     /**
      * Returns the SnapshotManager instance.
      *
      * @return the SnapshotManager instance.
      */
-    @Nonnull
-    SnapshotManager getSnapshotManager();
+    @NonNull SnapshotManager getSnapshotManager();
 
     /**
      * Returns the DataPersistenceProvider instance.
      *
      * @return the DataPersistenceProvider instance.
      */
-    @Nonnull
-    DataPersistenceProvider getPersistenceProvider();
+    @NonNull DataPersistenceProvider getPersistenceProvider();
 
     /**
      * Determines if there are any peer followers.
@@ -273,8 +260,7 @@ public interface RaftActorContext {
      *
      * @return the RaftPolicy instance.
      */
-    @Nonnull
-    RaftPolicy getRaftPolicy();
+    @NonNull RaftPolicy getRaftPolicy();
 
     /**
      * Determines if there have been any dynamic server configuration changes applied.
@@ -296,8 +282,7 @@ public interface RaftActorContext {
      * @return the peer information as a ServerConfigurationPayload or null if no dynamic server configurations have
      *         been applied.
      */
-    @Nullable
-    ServerConfigurationPayload getPeerServerInfo(boolean includeSelf);
+    @Nullable ServerConfigurationPayload getPeerServerInfo(boolean includeSelf);
 
     /**
      * Determines if this peer is a voting member of the cluster.
@@ -333,16 +318,14 @@ public interface RaftActorContext {
      *
      * @return the {@link FileBackedOutputStreamFactory};
      */
-    @Nonnull
-    FileBackedOutputStreamFactory getFileBackedOutputStreamFactory();
+    @NonNull FileBackedOutputStreamFactory getFileBackedOutputStreamFactory();
 
     /**
      * Returns the RaftActorLeadershipTransferCohort if leadership transfer is in progress.
      *
      * @return the RaftActorLeadershipTransferCohort if leadership transfer is in progress, null otherwise
      */
-    @Nullable
-    RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort();
+    @Nullable RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort();
 
     /**
      * Sets the RaftActorLeadershipTransferCohort for transferring leadership.
index 9c8fbe4..634bbd4 100644 (file)
@@ -5,9 +5,10 @@
  * 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.controller.cluster.raft;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorContext;
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
@@ -15,7 +16,6 @@ import akka.actor.ActorSystem;
 import akka.actor.Props;
 import akka.cluster.Cluster;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -26,8 +26,7 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.function.Consumer;
 import java.util.function.LongSupplier;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
@@ -94,25 +93,25 @@ public class RaftActorContextImpl implements RaftActorContext {
     private RaftActorLeadershipTransferCohort leadershipTransferCohort;
 
     public RaftActorContextImpl(final ActorRef actor, final ActorContext context, final String id,
-            @Nonnull final ElectionTerm termInformation, final long commitIndex, final long lastApplied,
-            @Nonnull final Map<String, String> peerAddresses,
-            @Nonnull final ConfigParams configParams, @Nonnull final DataPersistenceProvider persistenceProvider,
-            @Nonnull final Consumer<ApplyState> applyStateConsumer, @Nonnull final Logger logger) {
+            final @NonNull ElectionTerm termInformation, final long commitIndex, final long lastApplied,
+            final @NonNull Map<String, String> peerAddresses,
+            final @NonNull ConfigParams configParams, final @NonNull DataPersistenceProvider persistenceProvider,
+            final @NonNull Consumer<ApplyState> applyStateConsumer, final @NonNull Logger logger) {
         this.actor = actor;
         this.context = context;
         this.id = id;
-        this.termInformation = Preconditions.checkNotNull(termInformation);
+        this.termInformation = requireNonNull(termInformation);
         this.commitIndex = commitIndex;
         this.lastApplied = lastApplied;
-        this.configParams = Preconditions.checkNotNull(configParams);
-        this.persistenceProvider = Preconditions.checkNotNull(persistenceProvider);
-        this.log = Preconditions.checkNotNull(logger);
-        this.applyStateConsumer = Preconditions.checkNotNull(applyStateConsumer);
+        this.configParams = requireNonNull(configParams);
+        this.persistenceProvider = requireNonNull(persistenceProvider);
+        this.log = requireNonNull(logger);
+        this.applyStateConsumer = requireNonNull(applyStateConsumer);
 
         fileBackedOutputStreamFactory = new FileBackedOutputStreamFactory(
                 configParams.getFileBackedStreamingThreshold(), configParams.getTempFileDirectory());
 
-        for (Map.Entry<String, String> e: Preconditions.checkNotNull(peerAddresses).entrySet()) {
+        for (Map.Entry<String, String> e : requireNonNull(peerAddresses).entrySet()) {
             peerInfoMap.put(e.getKey(), new PeerInfo(e.getKey(), e.getValue(), VotingState.VOTING));
         }
     }
@@ -404,7 +403,7 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     void setCurrentBehavior(final RaftActorBehavior behavior) {
-        this.currentBehavior = Preconditions.checkNotNull(behavior);
+        this.currentBehavior = requireNonNull(behavior);
     }
 
     @Override
@@ -429,15 +428,13 @@ public class RaftActorContextImpl implements RaftActorContext {
     }
 
     @Override
-    @Nullable
     public RaftActorLeadershipTransferCohort getRaftActorLeadershipTransferCohort() {
         return leadershipTransferCohort;
     }
 
     @Override
     @SuppressWarnings("checkstyle:hiddenField")
-    public void setRaftActorLeadershipTransferCohort(
-            @Nullable final RaftActorLeadershipTransferCohort leadershipTransferCohort) {
+    public void setRaftActorLeadershipTransferCohort(final RaftActorLeadershipTransferCohort leadershipTransferCohort) {
         this.leadershipTransferCohort = leadershipTransferCohort;
     }
 }
index 5b27d50..a572f30 100644 (file)
@@ -16,7 +16,7 @@ import com.google.common.base.Stopwatch;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.base.messages.LeaderTransitioning;
 import org.opendaylight.controller.cluster.raft.behaviors.Leader;
 import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
@@ -69,7 +69,7 @@ public class RaftActorLeadershipTransferCohort {
         this(raftActor, null);
     }
 
-    RaftActorLeadershipTransferCohort(final RaftActor raftActor, @Nullable final String requestedFollowerId) {
+    RaftActorLeadershipTransferCohort(final RaftActor raftActor, final @Nullable String requestedFollowerId) {
         this.raftActor = raftActor;
         this.requestedFollowerId = requestedFollowerId;
 
index e107be9..1f9b93a 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 
@@ -52,6 +52,5 @@ public interface RaftActorRecoveryCohort {
      *
      * @return the snapshot or null if there's no snapshot to restore
      */
-    @Nullable
-    Snapshot getRestoreFromSnapshot();
+    @Nullable Snapshot getRestoreFromSnapshot();
 }
index 3a35116..29641cb 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.Cancellable;
-import com.google.common.base.Preconditions;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -19,7 +20,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Queue;
 import java.util.UUID;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplyState;
 import org.opendaylight.controller.cluster.raft.base.messages.SnapshotComplete;
 import org.opendaylight.controller.cluster.raft.base.messages.TimeoutNow;
@@ -247,7 +248,7 @@ class RaftActorServerConfigurationSupport {
         }
 
         protected void operationComplete(final ServerOperationContext<?> operationContext,
-                @Nullable final ServerChangeStatus replyStatus) {
+                final @Nullable ServerChangeStatus replyStatus) {
             if (replyStatus != null) {
                 sendReply(operationContext, replyStatus);
             }
@@ -453,7 +454,7 @@ class RaftActorServerConfigurationSupport {
 
         InstallingSnapshot(final AddServerContext addServerContext, final Cancellable installSnapshotTimer) {
             super(addServerContext);
-            this.installSnapshotTimer = Preconditions.checkNotNull(installSnapshotTimer);
+            this.installSnapshotTimer = requireNonNull(installSnapshotTimer);
         }
 
         @Override
@@ -497,7 +498,7 @@ class RaftActorServerConfigurationSupport {
 
         WaitingForPriorSnapshotComplete(final AddServerContext addServerContext, final Cancellable snapshotTimer) {
             super(addServerContext);
-            this.snapshotTimer = Preconditions.checkNotNull(snapshotTimer);
+            this.snapshotTimer = requireNonNull(snapshotTimer);
         }
 
         @Override
@@ -609,7 +610,7 @@ class RaftActorServerConfigurationSupport {
         private final RemoveServerContext removeServerContext;
 
         protected RemoveServerState(final RemoveServerContext removeServerContext) {
-            this.removeServerContext = Preconditions.checkNotNull(removeServerContext);
+            this.removeServerContext = requireNonNull(removeServerContext);
 
         }
 
@@ -880,7 +881,7 @@ class RaftActorServerConfigurationSupport {
         private final String loggingContext;
 
         ServerOperationTimeout(final String loggingContext) {
-            this.loggingContext = Preconditions.checkNotNull(loggingContext, "loggingContext should not be null");
+            this.loggingContext = requireNonNull(loggingContext, "loggingContext should not be null");
         }
 
         String getLoggingContext() {
index a02b295..8887a65 100644 (file)
@@ -12,8 +12,8 @@ import com.google.common.io.ByteSource;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Optional;
-import javax.annotation.Nonnull;
-import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.controller.cluster.raft.persisted.Snapshot.State;
 
 /**
  * Interface for a class that participates in raft actor snapshotting.
@@ -35,14 +35,14 @@ public interface RaftActorSnapshotCohort {
      *        serialized data back to a State instance on the follower end. The serialization for snapshot install is
      *        passed off so the cost of serialization is not charged to the raft actor's thread.
      */
-    void createSnapshot(@Nonnull ActorRef actorRef, @Nonnull Optional<OutputStream> installSnapshotStream);
+    void createSnapshot(@NonNull ActorRef actorRef, @NonNull Optional<OutputStream> installSnapshotStream);
 
     /**
      * This method is called to apply a snapshot installed by the leader.
      *
      * @param snapshotState a snapshot of the state of the actor
      */
-    void applySnapshot(@Nonnull Snapshot.State snapshotState);
+    void applySnapshot(@NonNull State snapshotState);
 
     /**
      * This method is called to de-serialize snapshot data that was previously serialized via {@link #createSnapshot}
@@ -52,6 +52,5 @@ public interface RaftActorSnapshotCohort {
      * @return the converted snapshot State
      * @throws IOException if an error occurs accessing the ByteSource or de-serializing
      */
-    @Nonnull
-    Snapshot.State deserializeSnapshot(@Nonnull ByteSource snapshotBytes) throws IOException;
+    @NonNull State deserializeSnapshot(@NonNull ByteSource snapshotBytes) throws IOException;
 }
index 71576f6..095e85c 100644 (file)
@@ -5,13 +5,12 @@
  * 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.controller.cluster.raft;
 
 import akka.japi.Procedure;
 import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Represents the ReplicatedLog that needs to be kept in sync by the RaftActor.
@@ -26,16 +25,14 @@ public interface ReplicatedLog {
      * @return the ReplicatedLogEntry if found, otherwise null if the adjusted index less than 0 or
      *         greater than the size of the in-memory journal
      */
-    @Nullable
-    ReplicatedLogEntry get(long index);
+    @Nullable ReplicatedLogEntry get(long index);
 
     /**
      * Return the last replicated log entry in the log or null of not found.
      *
      * @return the last replicated log entry in the log or null of not found.
      */
-    @Nullable
-    ReplicatedLogEntry last();
+    @Nullable ReplicatedLogEntry last();
 
     /**
      * Return the index of the last entry in the log or -1 if the log is empty.
@@ -97,7 +94,7 @@ public interface ReplicatedLog {
      *        delivered after persistence is complete and the associated callback is executed.
      * @return true if the entry was successfully appended, false otherwise.
      */
-    boolean appendAndPersist(@Nonnull ReplicatedLogEntry replicatedLogEntry,
+    boolean appendAndPersist(@NonNull ReplicatedLogEntry replicatedLogEntry,
             @Nullable Procedure<ReplicatedLogEntry> callback, boolean doAsync);
 
     /**
@@ -106,7 +103,7 @@ public interface ReplicatedLog {
      * @param index the index of the first log entry to get.
      * @return the List of entries
      */
-    @Nonnull List<ReplicatedLogEntry> getFrom(long index);
+    @NonNull List<ReplicatedLogEntry> getFrom(long index);
 
     /**
      * Returns a list of log entries starting from the given index up to the given maximum of entries or
@@ -117,7 +114,7 @@ public interface ReplicatedLog {
      * @param maxDataSize the maximum accumulated size of the log entries to get
      * @return the List of entries meeting the criteria.
      */
-    @Nonnull List<ReplicatedLogEntry> getFrom(long index, int maxEntries, long maxDataSize);
+    @NonNull List<ReplicatedLogEntry> getFrom(long index, int maxEntries, long maxDataSize);
 
     /**
      * Returns the number of entries in the journal.
index 764bce1..45b0b38 100644 (file)
@@ -7,12 +7,11 @@
  */
 package org.opendaylight.controller.cluster.raft;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.japi.Procedure;
-import com.google.common.base.Preconditions;
 import java.util.Collections;
 import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.persisted.DeleteEntries;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
@@ -29,7 +28,7 @@ final class ReplicatedLogImpl extends AbstractReplicatedLogImpl {
             final List<ReplicatedLogEntry> unAppliedEntries,
             final RaftActorContext context) {
         super(snapshotIndex, snapshotTerm, unAppliedEntries, context.getId());
-        this.context = Preconditions.checkNotNull(context);
+        this.context = requireNonNull(context);
     }
 
     static ReplicatedLog newInstance(final Snapshot snapshot, final RaftActorContext context) {
@@ -93,8 +92,8 @@ final class ReplicatedLogImpl extends AbstractReplicatedLogImpl {
     }
 
     @Override
-    public boolean appendAndPersist(@Nonnull final ReplicatedLogEntry replicatedLogEntry,
-            @Nullable final Procedure<ReplicatedLogEntry> callback, final boolean doAsync)  {
+    public boolean appendAndPersist(final ReplicatedLogEntry replicatedLogEntry,
+            final Procedure<ReplicatedLogEntry> callback, final boolean doAsync)  {
 
         context.getLogger().debug("{}: Append log entry and persist {} ", context.getId(), replicatedLogEntry);
 
index dd9445e..8674ef4 100644 (file)
@@ -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.controller.cluster.raft;
 
 import akka.persistence.SnapshotSelectionCriteria;
@@ -16,7 +15,7 @@ import java.io.OutputStream;
 import java.util.List;
 import java.util.Optional;
 import java.util.function.Consumer;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStream;
 import org.opendaylight.controller.cluster.raft.base.messages.ApplySnapshot;
 import org.opendaylight.controller.cluster.raft.base.messages.CaptureSnapshot;
@@ -127,8 +126,7 @@ public class SnapshotManager implements SnapshotState {
         this.snapshotCohort = snapshotCohort;
     }
 
-    @Nonnull
-    public Snapshot.State convertSnapshot(final ByteSource snapshotBytes) throws IOException {
+    public Snapshot.@NonNull State convertSnapshot(final ByteSource snapshotBytes) throws IOException {
         return snapshotCohort.deserializeSnapshot(snapshotBytes);
     }
 
index 7fec7e2..c9660d9 100644 (file)
@@ -5,12 +5,12 @@
  * 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.controller.cluster.raft.base.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.dispatch.ControlMessage;
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 /**
@@ -32,22 +32,20 @@ public class ApplySnapshot implements ControlMessage {
     private final Snapshot snapshot;
     private final Callback callback;
 
-    public ApplySnapshot(Snapshot snapshot) {
+    public ApplySnapshot(@NonNull Snapshot snapshot) {
         this(snapshot, NOOP_CALLBACK);
     }
 
-    public ApplySnapshot(@Nonnull Snapshot snapshot, @Nonnull Callback callback) {
-        this.snapshot = Preconditions.checkNotNull(snapshot);
-        this.callback = Preconditions.checkNotNull(callback);
+    public ApplySnapshot(@NonNull Snapshot snapshot, @NonNull Callback callback) {
+        this.snapshot = requireNonNull(snapshot);
+        this.callback = requireNonNull(callback);
     }
 
-    @Nonnull
-    public Snapshot getSnapshot() {
+    public @NonNull Snapshot getSnapshot() {
         return snapshot;
     }
 
-    @Nonnull
-    public Callback getCallback() {
+    public @NonNull Callback getCallback() {
         return callback;
     }
 
index f0e16a0..552c7df 100644 (file)
@@ -7,30 +7,29 @@
  */
 package org.opendaylight.controller.cluster.raft.base.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.dispatch.ControlMessage;
-import com.google.common.base.Preconditions;
 import java.io.OutputStream;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 public class CaptureSnapshotReply implements ControlMessage {
     private final Snapshot.State snapshotState;
     private final Optional<OutputStream> installSnapshotStream;
 
-    public CaptureSnapshotReply(@Nonnull final Snapshot.State snapshotState,
-            @Nonnull final Optional<OutputStream> installSnapshotStream) {
-        this.snapshotState = Preconditions.checkNotNull(snapshotState);
-        this.installSnapshotStream = Preconditions.checkNotNull(installSnapshotStream);
+    public CaptureSnapshotReply(final Snapshot.@NonNull State snapshotState,
+            final @NonNull Optional<OutputStream> installSnapshotStream) {
+        this.snapshotState = requireNonNull(snapshotState);
+        this.installSnapshotStream = requireNonNull(installSnapshotStream);
     }
 
-    @Nonnull
-    public Snapshot.State getSnapshotState() {
+    public Snapshot.@NonNull State getSnapshotState() {
         return snapshotState;
     }
 
-    @Nonnull
-    public Optional<OutputStream> getInstallSnapshotStream() {
+    public @NonNull Optional<OutputStream> getInstallSnapshotStream() {
         return installSnapshotStream;
     }
 }
index 00ef63c..e4571c6 100644 (file)
@@ -5,11 +5,11 @@
  * 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.controller.cluster.raft.base.messages;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * The FollowerInitialSyncUpStatus is sent by a Follower to inform any RaftActor subclass whether the Follower
@@ -21,16 +21,16 @@ public final class FollowerInitialSyncUpStatus {
     private final boolean initialSyncDone;
     private final String name;
 
-    public FollowerInitialSyncUpStatus(final boolean initialSyncDone, @Nonnull final String name) {
+    public FollowerInitialSyncUpStatus(final boolean initialSyncDone, final @NonNull String name) {
         this.initialSyncDone = initialSyncDone;
-        this.name = Preconditions.checkNotNull(name);
+        this.name = requireNonNull(name);
     }
 
     public boolean isInitialSyncDone() {
         return initialSyncDone;
     }
 
-    @Nonnull public String getName() {
+    public @NonNull String getName() {
         return name;
     }
 }
index fd2fb68..c18b9d4 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.raft.base.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Message sent from a leader to its followers to indicate leadership transfer is starting.
@@ -21,12 +22,11 @@ public final class LeaderTransitioning implements Serializable {
 
     private final String leaderId;
 
-    public LeaderTransitioning(@Nonnull final String leaderId) {
-        this.leaderId = Preconditions.checkNotNull(leaderId);
+    public LeaderTransitioning(final @NonNull String leaderId) {
+        this.leaderId = requireNonNull(leaderId);
     }
 
-    @Nonnull
-    public String getLeaderId() {
+    public @NonNull String getLeaderId() {
         return leaderId;
     }
 
index e8d58f2..cdb94d4 100644 (file)
@@ -5,12 +5,12 @@
  * 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.controller.cluster.raft.base.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.io.ByteSource;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 /**
@@ -18,20 +18,19 @@ import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
  * prompt the leader to install the snapshot on its followers as needed.
  */
 public final class SendInstallSnapshot {
-    private final Snapshot snapshot;
-    private final ByteSource snapshotBytes;
+    private final @NonNull Snapshot snapshot;
+    private final @NonNull ByteSource snapshotBytes;
 
-    public SendInstallSnapshot(@Nonnull Snapshot snapshot, @Nonnull ByteSource snapshotBytes) {
-        this.snapshot = Preconditions.checkNotNull(snapshot);
-        this.snapshotBytes = Preconditions.checkNotNull(snapshotBytes);
+    public SendInstallSnapshot(@NonNull Snapshot snapshot, @NonNull ByteSource snapshotBytes) {
+        this.snapshot = requireNonNull(snapshot);
+        this.snapshotBytes = requireNonNull(snapshotBytes);
     }
 
-    @Nonnull
-    public Snapshot getSnapshot() {
+    public @NonNull Snapshot getSnapshot() {
         return snapshot;
     }
 
-    public ByteSource getSnapshotBytes() {
+    public @NonNull ByteSource getSnapshotBytes() {
         return snapshotBytes;
     }
 }
index fbdfd49..fef6cc8 100644 (file)
@@ -5,16 +5,17 @@
  * 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.controller.cluster.raft.behaviors;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import akka.actor.Cancellable;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.io.ByteSource;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
 import java.util.Collection;
@@ -27,7 +28,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Queue;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.io.SharedFileBackedOutputStream;
 import org.opendaylight.controller.cluster.messaging.MessageSlicer;
 import org.opendaylight.controller.cluster.messaging.SliceOptions;
@@ -101,7 +102,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
     private int minReplicationCount;
 
     protected AbstractLeader(final RaftActorContext context, final RaftState state,
-            @Nullable final AbstractLeader initializeFromLeader) {
+            final @Nullable AbstractLeader initializeFromLeader) {
         super(context, state);
 
         appendEntriesMessageSlicer = MessageSlicer.builder().logContext(logName())
@@ -184,7 +185,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
     }
 
     @VisibleForTesting
-    void setSnapshotHolder(@Nullable final SnapshotHolder snapshotHolder) {
+    void setSnapshotHolder(final @Nullable SnapshotHolder snapshotHolder) {
         this.snapshotHolder = Optional.fromNullable(snapshotHolder);
     }
 
@@ -455,7 +456,7 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
 
     @Override
     public RaftActorBehavior handleMessage(final ActorRef sender, final Object message) {
-        Preconditions.checkNotNull(sender, "sender should not be null");
+        requireNonNull(sender, "sender should not be null");
 
         if (appendEntriesMessageSlicer.handleMessage(message)) {
             return this;
@@ -511,6 +512,8 @@ public abstract class AbstractLeader extends AbstractRaftActorBehavior {
         return this;
     }
 
+    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS",
+            justification = "JDT nullness with SpotBugs at setSnapshotHolder(null)")
     private void handleInstallSnapshotReply(final InstallSnapshotReply reply) {
         log.debug("{}: handleInstallSnapshotReply: {}", logName(), reply);
 
index f6276a6..4fa4dbf 100644 (file)
@@ -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.controller.cluster.raft.behaviors;
 
 import akka.actor.ActorRef;
@@ -25,7 +24,7 @@ import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.messaging.MessageAssembler;
 import org.opendaylight.controller.cluster.raft.RaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftState;
@@ -94,7 +93,7 @@ public class Follower extends AbstractRaftActorBehavior {
     }
 
     @VisibleForTesting
-    protected final void setLeaderId(@Nullable final String leaderId) {
+    protected final void setLeaderId(final @Nullable String leaderId) {
         this.leaderId = leaderId;
     }
 
index 9ba39c2..17e4220 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.raft.behaviors;
 
 import akka.actor.ActorRef;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.RaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftState;
 import org.opendaylight.controller.cluster.raft.messages.AppendEntriesReply;
index eb49abc..21f823d 100644 (file)
@@ -7,15 +7,16 @@
  */
 package org.opendaylight.controller.cluster.raft.behaviors;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import akka.actor.ActorSelection;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Stopwatch;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.FollowerLogInformation;
 import org.opendaylight.controller.cluster.raft.RaftActorContext;
 import org.opendaylight.controller.cluster.raft.RaftActorLeadershipTransferCohort;
@@ -54,7 +55,7 @@ public class Leader extends AbstractLeader {
     static final Object ISOLATED_LEADER_CHECK = new Object();
 
     private final Stopwatch isolatedLeaderCheck = Stopwatch.createStarted();
-    @Nullable private LeadershipTransferContext leadershipTransferContext;
+    private @Nullable LeadershipTransferContext leadershipTransferContext;
 
     Leader(RaftActorContext context, @Nullable AbstractLeader initializeFromLeader) {
         super(context, RaftState.Leader, initializeFromLeader);
@@ -66,7 +67,7 @@ public class Leader extends AbstractLeader {
 
     @Override
     public RaftActorBehavior handleMessage(ActorRef sender, Object originalMessage) {
-        Preconditions.checkNotNull(sender, "sender should not be null");
+        requireNonNull(sender, "sender should not be null");
 
         if (ISOLATED_LEADER_CHECK.equals(originalMessage)) {
             if (isLeaderIsolated()) {
@@ -121,7 +122,7 @@ public class Leader extends AbstractLeader {
      *
      * @param leadershipTransferCohort the cohort participating in the leadership transfer
      */
-    public void transferLeadership(@Nonnull RaftActorLeadershipTransferCohort leadershipTransferCohort) {
+    public void transferLeadership(@NonNull RaftActorLeadershipTransferCohort leadershipTransferCohort) {
         log.debug("{}: Attempting to transfer leadership", logName());
 
         leadershipTransferContext = new LeadershipTransferContext(leadershipTransferCohort);
index 6b51c34..ed02706 100644 (file)
@@ -5,11 +5,10 @@
  * 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.controller.cluster.raft.behaviors;
 
 import akka.actor.ActorRef;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.raft.RaftState;
 
 /**
@@ -28,8 +27,7 @@ public interface RaftActorBehavior extends AutoCloseable {
      *
      * @return The new behavior or current behavior, or null if the message was not handled.
      */
-    @Nullable
-    RaftActorBehavior handleMessage(ActorRef sender, Object message);
+    @Nullable RaftActorBehavior handleMessage(ActorRef sender, Object message);
 
     /**
      * Returns the state associated with this behavior.
@@ -43,8 +41,7 @@ public interface RaftActorBehavior extends AutoCloseable {
      *
      * @return the id of the leader or null if not known
      */
-    @Nullable
-    String getLeaderId();
+    @Nullable String getLeaderId();
 
     /**
      * Sets the index of the last log entry that has been replicated to all peers.
index 90cec9d..b4b3443 100644 (file)
@@ -5,13 +5,12 @@
  * 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.controller.cluster.raft.client.messages;
 
 import com.google.common.annotations.VisibleForTesting;
 import java.io.Serializable;
 import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Reply to {@link FindLeader} message, containing the address of the leader actor, as known to the raft actor which
@@ -26,7 +25,7 @@ public final class FindLeaderReply implements Serializable {
     private static final long serialVersionUID = 1L;
     private final String leaderActor;
 
-    public FindLeaderReply(@Nullable final String leaderActor) {
+    public FindLeaderReply(final @Nullable String leaderActor) {
         this.leaderActor = leaderActor;
     }
 
index b0c36ac..36c5346 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.raft.client.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
 
 /**
@@ -21,21 +22,19 @@ public class GetSnapshotReply {
     private final String id;
     private final Snapshot snapshot;
 
-    public GetSnapshotReply(@Nonnull String id, @Nonnull Snapshot snapshot) {
-        this.id = Preconditions.checkNotNull(id);
-        this.snapshot = Preconditions.checkNotNull(snapshot);
+    public GetSnapshotReply(@NonNull String id, @NonNull Snapshot snapshot) {
+        this.id = requireNonNull(id);
+        this.snapshot = requireNonNull(snapshot);
     }
 
-    @Nonnull
-    public String getId() {
+    public @NonNull String getId() {
         return id;
     }
 
     @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "Exposes a mutable object stored in a field but "
             + "this is OK since this class is merely a DTO and does not process the byte[] internally. "
             + "Also it would be inefficient to create a return copy as the byte[] could be large.")
-    @Nonnull
-    public Snapshot getSnapshot() {
+    public @NonNull Snapshot getSnapshot() {
         return snapshot;
     }
 
index d9298f9..7ded55b 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.collect.ImmutableMap;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * The response to a GetOnDemandRaftState message.
@@ -139,8 +139,7 @@ public class OnDemandRaftState {
             return (B) this;
         }
 
-        @Nonnull
-        protected abstract OnDemandRaftState state();
+        protected abstract @NonNull OnDemandRaftState state();
 
         public B lastLogIndex(long value) {
             state().lastLogIndex = value;
index 3f0cf43..d37b52c 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.controller.cluster.raft.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.io.Serializable;
 import java.util.Optional;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Abstract base class for a server configuration change reply.
@@ -26,17 +27,17 @@ public abstract class AbstractServerChangeReply implements Serializable {
     private final String leaderHint;
     private final ServerChangeStatus status;
 
-    AbstractServerChangeReply(final @Nonnull ServerChangeStatus status, final @Nullable String leaderHint) {
-        this.status = Preconditions.checkNotNull(status);
+    AbstractServerChangeReply(final @NonNull ServerChangeStatus status, final @Nullable String leaderHint) {
+        this.status = requireNonNull(status);
         this.leaderHint = leaderHint;
     }
 
     @VisibleForTesting
-    @Nonnull public final Optional<String> getLeaderHint() {
+    public final @NonNull Optional<String> getLeaderHint() {
         return Optional.ofNullable(leaderHint);
     }
 
-    @Nonnull public final ServerChangeStatus getStatus() {
+    public final @NonNull ServerChangeStatus getStatus() {
         return status;
     }
 
index d77a084..67c6899 100644 (file)
@@ -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.controller.cluster.raft.messages;
 
 import static java.util.Objects.requireNonNull;
@@ -18,8 +17,8 @@ import java.io.ObjectOutput;
 import java.util.ArrayList;
 import java.util.List;
 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.controller.cluster.raft.RaftVersions;
 import org.opendaylight.controller.cluster.raft.ReplicatedLogEntry;
 import org.opendaylight.controller.cluster.raft.persisted.SimpleReplicatedLogEntry;
@@ -58,8 +57,8 @@ public class AppendEntries extends AbstractRaftRPC {
 
     private final String leaderAddress;
 
-    private AppendEntries(long term, @Nonnull String leaderId, long prevLogIndex, long prevLogTerm,
-            @Nonnull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
+    private AppendEntries(long term, @NonNull String leaderId, long prevLogIndex, long prevLogTerm,
+            @NonNull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
             short payloadVersion, short recipientRaftVersion, short leaderRaftVersion, @Nullable String leaderAddress) {
         super(term);
         this.leaderId = requireNonNull(leaderId);
@@ -74,23 +73,22 @@ public class AppendEntries extends AbstractRaftRPC {
         this.leaderAddress = leaderAddress;
     }
 
-    public AppendEntries(long term, @Nonnull String leaderId, long prevLogIndex, long prevLogTerm,
-            @Nonnull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
+    public AppendEntries(long term, @NonNull String leaderId, long prevLogIndex, long prevLogTerm,
+            @NonNull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
             short payloadVersion, short recipientRaftVersion, @Nullable String leaderAddress) {
         this(term, leaderId, prevLogIndex, prevLogTerm, entries, leaderCommit, replicatedToAllIndex, payloadVersion,
                 recipientRaftVersion, RaftVersions.CURRENT_VERSION, leaderAddress);
     }
 
     @VisibleForTesting
-    public AppendEntries(long term, @Nonnull String leaderId, long prevLogIndex, long prevLogTerm,
-            @Nonnull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
+    public AppendEntries(long term, @NonNull String leaderId, long prevLogIndex, long prevLogTerm,
+            @NonNull List<ReplicatedLogEntry> entries, long leaderCommit, long replicatedToAllIndex,
             short payloadVersion) {
         this(term, leaderId, prevLogIndex, prevLogTerm, entries, leaderCommit, replicatedToAllIndex, payloadVersion,
                 RaftVersions.CURRENT_VERSION, null);
     }
 
-    @Nonnull
-    public String getLeaderId() {
+    public @NonNull String getLeaderId() {
         return leaderId;
     }
 
@@ -102,8 +100,7 @@ public class AppendEntries extends AbstractRaftRPC {
         return prevLogTerm;
     }
 
-    @Nonnull
-    public List<ReplicatedLogEntry> getEntries() {
+    public @NonNull List<ReplicatedLogEntry> getEntries() {
         return entries;
     }
 
index 3dc3693..625d970 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.controller.cluster.raft.messages;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.collect.ImmutableSet;
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Message sent to change the raft voting status for servers.
@@ -27,23 +27,21 @@ public class ChangeServersVotingStatus implements Serializable {
     private final Map<String, Boolean> serverVotingStatusMap;
     private final Collection<String> serversVisited;
 
-    public ChangeServersVotingStatus(@Nonnull Map<String, Boolean> serverVotingStatusMap) {
-        this(serverVotingStatusMap, Collections.emptySet());
+    public ChangeServersVotingStatus(@NonNull Map<String, Boolean> serverVotingStatusMap) {
+        this(serverVotingStatusMap, ImmutableSet.of());
     }
 
-    public ChangeServersVotingStatus(@Nonnull Map<String, Boolean> serverVotingStatusMap,
-            @Nonnull Collection<String> serversVisited) {
-        this.serverVotingStatusMap = new HashMap<>(Preconditions.checkNotNull(serverVotingStatusMap));
-        this.serversVisited = ImmutableSet.copyOf(Preconditions.checkNotNull(serversVisited));
+    public ChangeServersVotingStatus(@NonNull Map<String, Boolean> serverVotingStatusMap,
+            @NonNull Collection<String> serversVisited) {
+        this.serverVotingStatusMap = new HashMap<>(requireNonNull(serverVotingStatusMap));
+        this.serversVisited = ImmutableSet.copyOf(requireNonNull(serversVisited));
     }
 
-    @Nonnull
-    public Map<String, Boolean> getServerVotingStatusMap() {
+    public @NonNull Map<String, Boolean> getServerVotingStatusMap() {
         return serverVotingStatusMap;
     }
 
-    @Nonnull
-    public Collection<String> getServersVisited() {
+    public @NonNull Collection<String> getServersVisited() {
         return serversVisited;
     }
 
index fe643d8..8a59229 100644 (file)
@@ -5,10 +5,9 @@
  * 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.controller.cluster.raft.messages;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Reply to a RemoveServer message (ยง4.1).
index ee4ac9d..080759f 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster.raft.persisted;
 
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Transitional marker interface for use with evolution of serializable classes held in persistence. This interface
@@ -30,5 +30,5 @@ public interface MigratedSerializable extends Serializable {
      *
      * @return Serialization proxy.
      */
-    @Nonnull Object writeReplace();
+    @NonNull Object writeReplace();
 }
index e9fc53a..0559842 100644 (file)
@@ -18,7 +18,7 @@ import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.PersistentPayload;
 import org.slf4j.Logger;
@@ -80,12 +80,11 @@ public final class ServerConfigurationPayload extends Payload implements Persist
     private final List<ServerInfo> serverConfig;
     private int serializedSize = -1;
 
-    public ServerConfigurationPayload(@Nonnull final List<ServerInfo> serverConfig) {
+    public ServerConfigurationPayload(final @NonNull List<ServerInfo> serverConfig) {
         this.serverConfig = ImmutableList.copyOf(serverConfig);
     }
 
-    @Nonnull
-    public List<ServerInfo> getServerConfig() {
+    public @NonNull List<ServerInfo> getServerConfig() {
         return serverConfig;
     }
 
index c419f7e..6e1ca82 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.cluster.raft.persisted;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Server information. This class is not directly Serializable, as it is serialized directly as part of
@@ -20,13 +21,12 @@ public final class ServerInfo {
     private final String id;
     private final boolean isVoting;
 
-    public ServerInfo(@Nonnull String id, boolean isVoting) {
-        this.id = Preconditions.checkNotNull(id);
+    public ServerInfo(@NonNull String id, boolean isVoting) {
+        this.id = requireNonNull(id);
         this.isVoting = isVoting;
     }
 
-    @Nonnull
-    public String getId() {
+    public @NonNull String getId() {
         return id;
     }
 
index 28cc9b3..9c58e6b 100644 (file)
@@ -25,7 +25,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
 import org.apache.commons.lang3.SerializationUtils;
 import org.opendaylight.controller.cluster.DataPersistenceProvider;
 import org.opendaylight.controller.cluster.raft.behaviors.RaftActorBehavior;
@@ -134,7 +133,6 @@ public class MockRaftActor extends RaftActor implements RaftActorRecoveryCohort,
     }
 
     @Override
-    @Nonnull
     protected RaftActorRecoveryCohort getRaftActorRecoveryCohort() {
         return this;
     }
index 7b240d7..fa974b0 100644 (file)
@@ -20,8 +20,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nullable;
 import org.apache.commons.lang3.SerializationUtils;
+import org.eclipse.jdt.annotation.Nullable;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.raft.MockRaftActorContext.MockPayload;
index b32b4f4..039c15c 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.cluster.raft.persisted;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.util.Arrays;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Snapshot State implementation backed by a byte[].
@@ -19,21 +20,21 @@ import javax.annotation.Nonnull;
 public final class ByteState implements Snapshot.State {
     private static final long serialVersionUID = 1L;
 
-    private final byte[] bytes;
+    private final byte @NonNull[] bytes;
 
-    private ByteState(@Nonnull final byte[] bytes) {
-        this.bytes = Preconditions.checkNotNull(bytes);
+    private ByteState(final byte @NonNull[] bytes) {
+        this.bytes = requireNonNull(bytes);
     }
 
-    public static ByteState of(@Nonnull final byte[] bytes) {
+    public static @NonNull ByteState of(final byte @NonNull[] bytes) {
         return new ByteState(bytes);
     }
 
-    public static ByteState empty() {
+    public static @NonNull ByteState empty() {
         return new ByteState(new byte[0]);
     }
 
-    public byte[] getBytes() {
+    public byte @NonNull[] getBytes() {
         return bytes;
     }
 
index c43d42c..5448f79 100644 (file)
@@ -5,13 +5,12 @@
  * 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.controller.md.sal.binding.api;
 
 import com.google.common.collect.Collections2;
 import java.util.Collection;
-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.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
@@ -56,14 +55,14 @@ public interface DataObjectModification<T extends DataObject>
      *
      * @return type of modified object.
      */
-    @Nonnull Class<T> getDataType();
+    @NonNull Class<T> getDataType();
 
     /**
      * Returns type of modification.
      *
      * @return type Type of performed modification.
      */
-    @Nonnull ModificationType getModificationType();
+    @NonNull ModificationType getModificationType();
 
     /**
      * Returns before-state of top level container. Implementations are encouraged,
@@ -86,7 +85,7 @@ public interface DataObjectModification<T extends DataObject>
      *
      * @return unmodifiable collection of modified direct children.
      */
-    @Nonnull Collection<? extends DataObjectModification<? extends DataObject>> getModifiedChildren();
+    @NonNull Collection<? extends DataObjectModification<? extends DataObject>> getModifiedChildren();
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification. This method should be
@@ -99,8 +98,8 @@ public interface DataObjectModification<T extends DataObject>
      *         to generated model.
      */
     default <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>>
-        Collection<DataObjectModification<C>> getModifiedChildren(@Nonnull final Class<H> caseType,
-                @Nonnull final Class<C> childType) {
+        Collection<DataObjectModification<C>> getModifiedChildren(final @NonNull Class<H> caseType,
+                final @NonNull Class<C> childType) {
         final Item<C> item = Item.of(caseType, childType);
         return (Collection<DataObjectModification<C>>) Collections2.filter(getModifiedChildren(),
             mod -> item.equals(mod.getIdentifier()));
@@ -120,8 +119,8 @@ public interface DataObjectModification<T extends DataObject>
      *         to generated model.
      */
     default @Nullable <H extends ChoiceIn<? super T> & DataObject, C extends ChildOf<? super H>>
-            DataObjectModification<C> getModifiedChildContainer(@Nonnull final Class<H> caseType,
-                    @Nonnull final Class<C> child) {
+            DataObjectModification<C> getModifiedChildContainer(final @NonNull Class<H> caseType,
+                    final @NonNull Class<C> child) {
         return (DataObjectModification<C>) getModifiedChild(Item.of(caseType, child));
     }
 
@@ -137,7 +136,7 @@ public interface DataObjectModification<T extends DataObject>
      *         to generated model.
      */
     @Nullable <C extends ChildOf<? super T>> DataObjectModification<C> getModifiedChildContainer(
-            @Nonnull Class<C> child);
+            @NonNull Class<C> child);
 
     /**
      * Returns augmentation child modification if {@code augmentation} was modified by this modification.
@@ -151,7 +150,7 @@ public interface DataObjectModification<T extends DataObject>
      *         according to generated model.
      */
     @Nullable <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(
-            @Nonnull Class<C> augmentation);
+            @NonNull Class<C> augmentation);
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification.
@@ -163,7 +162,7 @@ public interface DataObjectModification<T extends DataObject>
      *         to generated model.
      */
     <N extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<N>> DataObjectModification<N>
-            getModifiedChildListItem(@Nonnull Class<N> listItem, @Nonnull K listKey);
+            getModifiedChildListItem(@NonNull Class<N> listItem, @NonNull K listKey);
 
     /**
      * Returns child list item modification if {@code child} was modified by this modification.
@@ -177,7 +176,7 @@ public interface DataObjectModification<T extends DataObject>
      */
     default <H extends ChoiceIn<? super T> & DataObject, C extends Identifiable<K> & ChildOf<? super H>,
             K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
-                    @Nonnull final Class<H> caseType, @Nonnull final Class<C> listItem, @Nonnull final K listKey) {
+                    final @NonNull Class<H> caseType, final @NonNull Class<C> listItem, final @NonNull K listKey) {
         return (DataObjectModification<C>) getModifiedChild(IdentifiableItem.of(caseType, listItem, listKey));
     }
 
index 6d6bae1..222242e 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.binding.api;
 
 import java.util.Collection;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
@@ -44,5 +44,5 @@ public interface DataTreeChangeListener<T extends DataObject> extends EventListe
      *
      * @param changes Collection of change events, may not be null or empty.
      */
-    void onDataTreeChanged(@Nonnull Collection<DataTreeModification<T>> changes);
+    void onDataTreeChanged(@NonNull Collection<DataTreeModification<T>> changes);
 }
index 11697bf..db44e50 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.binding.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
@@ -54,6 +54,6 @@ public interface DataTreeChangeService extends BindingService {
      *         your listener using {@link ListenerRegistration#close()} to stop
      *         delivery of change events.
      */
-    @Nonnull <T extends DataObject,L extends DataTreeChangeListener<T>> ListenerRegistration<L>
-            registerDataTreeChangeListener(@Nonnull DataTreeIdentifier<T> treeId, @Nonnull L listener);
+    <T extends DataObject, L extends DataTreeChangeListener<T>> @NonNull ListenerRegistration<L>
+            registerDataTreeChangeListener(@NonNull DataTreeIdentifier<T> treeId, @NonNull L listener);
 }
index 79b2a6d..94e1f8b 100644 (file)
@@ -7,9 +7,10 @@
  */
 package org.opendaylight.controller.md.sal.binding.api;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Serializable;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.concepts.Path;
@@ -23,12 +24,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 public final class DataTreeIdentifier<T extends DataObject> implements Immutable,
         Path<DataTreeIdentifier<?>>, Serializable {
     private static final long serialVersionUID = 1L;
-    private final InstanceIdentifier<T> rootIdentifier;
-    private final LogicalDatastoreType datastoreType;
+
+    private final @NonNull InstanceIdentifier<T> rootIdentifier;
+    private final @NonNull LogicalDatastoreType datastoreType;
 
     public DataTreeIdentifier(final LogicalDatastoreType datastoreType, final InstanceIdentifier<T> rootIdentifier) {
-        this.datastoreType = Preconditions.checkNotNull(datastoreType);
-        this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier);
+        this.datastoreType = requireNonNull(datastoreType);
+        this.rootIdentifier = requireNonNull(rootIdentifier);
     }
 
     /**
@@ -36,7 +38,7 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
      *
      * @return Logical data store type. Guaranteed to be non-null.
      */
-    public @Nonnull LogicalDatastoreType getDatastoreType() {
+    public @NonNull LogicalDatastoreType getDatastoreType() {
         return datastoreType;
     }
 
@@ -45,7 +47,7 @@ public final class DataTreeIdentifier<T extends DataObject> implements Immutable
      *
      * @return Instance identifier corresponding to the root node.
      */
-    public @Nonnull InstanceIdentifier<T> getRootIdentifier() {
+    public @NonNull InstanceIdentifier<T> getRootIdentifier() {
         return rootIdentifier;
     }
 
index 374c185..bd35c63 100644 (file)
@@ -5,10 +5,9 @@
  * 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.controller.md.sal.binding.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
 /**
@@ -25,13 +24,12 @@ public interface DataTreeModification<T extends DataObject> {
      *
      * @return absolute path of the root node
      */
-    @Nonnull DataTreeIdentifier<T> getRootPath();
+    @NonNull DataTreeIdentifier<T> getRootPath();
 
     /**
      * Get the modification root node.
      *
      * @return modification root node
      */
-    @Nonnull DataObjectModification<T> getRootNode();
-
+    @NonNull DataObjectModification<T> getRootNode();
 }
index 992654e..40b8b8c 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.binding.api;
 
 import com.google.common.collect.ForwardingObject;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 public abstract class ForwardingDataBroker extends ForwardingObject implements DataBroker {
 
     @Override
-    protected abstract @Nonnull DataBroker delegate();
+    protected abstract @NonNull DataBroker delegate();
 
     @Override
     public ReadOnlyTransaction newReadOnlyTransaction() {
index 5189e8f..712d025 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.controller.md.sal.binding.compat;
 
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.binding.impl.LazySerializedDOMNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
@@ -29,7 +28,7 @@ final class FunctionalNotificationListenerAdapter<N extends Notification> implem
     }
 
     @Override
-    public void onNotification(@Nonnull final DOMNotification notification) {
+    public void onNotification(final DOMNotification notification) {
         delegate.onNotification(type.cast(deserialize(notification)));
     }
 
index 9e5b8cc..f749cb2 100644 (file)
@@ -14,7 +14,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
 import org.opendaylight.mdsal.binding.dom.adapter.invoke.NotificationListenerInvoker;
@@ -39,7 +38,7 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener {
     }
 
     @Override
-    public void onNotification(@Nonnull final DOMNotification notification) {
+    public void onNotification(final DOMNotification notification) {
         final Notification baNotification = deserialize(notification);
         final QName notificationQName = notification.getType().getLastComponent();
         getInvoker(notification.getType()).invokeNotification(delegate, notificationQName, baNotification);
index d70d2d6..72ee08f 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.controller.md.sal.binding.impl;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -17,7 +18,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
@@ -59,14 +59,13 @@ public class BindingDOMRpcImplementationAdapter implements DOMRpcImplementation
             throw new IllegalArgumentException("Failed to create invokers for type " + type, e);
         }
 
-        this.codec = Preconditions.checkNotNull(codec);
-        this.delegate = Preconditions.checkNotNull(delegate);
+        this.codec = requireNonNull(codec);
+        this.delegate = requireNonNull(delegate);
         inputQname = QName.create(BindingReflections.getQNameModule(type), "input").intern();
     }
 
-    @Nonnull
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
+    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
             final NormalizedNode<?, ?> input) {
         final SchemaPath schemaPath = rpc.getType();
         final DataObject bindingInput = input != null ? deserialize(rpc.getType(), input) : null;
index aa39016..d8ba10c 100644 (file)
@@ -12,7 +12,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.lang.reflect.Method;
 import java.util.Iterator;
 import java.util.Map;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationException;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizationOperation;
 import org.opendaylight.controller.md.sal.common.impl.util.compat.DataNormalizer;
@@ -92,7 +91,6 @@ public class BindingToNormalizedNodeCodec
     }
 
     @Override
-    @Nonnull
     public Map.Entry<InstanceIdentifier<?>, BindingCodecTreeNode<?>> getSubtreeCodec(
             final YangInstanceIdentifier domIdentifier) {
         return super.getSubtreeCodec(domIdentifier);
index 9fa43ab..043501c 100644 (file)
@@ -5,15 +5,14 @@
  * 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.controller.md.sal.binding.impl;
 
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import java.lang.reflect.Method;
-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.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
@@ -57,8 +56,7 @@ abstract class ContextReferenceExtractor {
      */
     abstract @Nullable InstanceIdentifier<?> extract(DataObject obj);
 
-    @Nonnull
-    private static ContextReferenceExtractor create(final Class<?> key) {
+    private static @NonNull ContextReferenceExtractor create(final Class<?> key) {
         final Method contextGetter = getContextGetter(key);
         if (contextGetter == null) {
             return NULL_EXTRACTOR;
@@ -80,8 +78,7 @@ abstract class ContextReferenceExtractor {
         return NULL_EXTRACTOR;
     }
 
-    @Nullable
-    private static Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
+    private static @Nullable Method findGetValueMethod(final Class<?> type, final Class<?> returnType) {
         try {
             final Method method = type.getMethod(GET_VALUE_NAME);
             if (returnType.equals(method.getReturnType())) {
index ea3888e..d956746 100644 (file)
@@ -9,8 +9,8 @@ package org.opendaylight.controller.md.sal.binding.spi;
 
 import com.google.common.base.Optional;
 import com.google.common.cache.CacheLoader;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>, Optional<T>> {
 
@@ -29,9 +29,7 @@ public abstract class AdapterLoader<T, D> extends CacheLoader<Class<? extends T>
         return  Optional.<T>of(builder.build());
     }
 
-    @Nullable
-    protected abstract D getDelegate(Class<? extends D> reqDeleg);
+    protected abstract @Nullable D getDelegate(Class<? extends D> reqDeleg);
 
-    @Nonnull
-    protected abstract AdapterBuilder<? extends T, D> createBuilder(Class<? extends T> key);
+    protected abstract @NonNull AdapterBuilder<? extends T, D> createBuilder(Class<? extends T> key);
 }
index dcb3b6b..32e0210 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.cluster;
 
 import akka.actor.ActorSystem;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 /**
@@ -23,8 +23,7 @@ public interface ActorSystemProvider {
      *
      * @return the ActorSystem.
      */
-    @Nonnull
-    ActorSystem getActorSystem();
+    @NonNull ActorSystem getActorSystem();
 
     /**
      * Register a listener for ActorSystem lifecycle events.
@@ -33,5 +32,5 @@ public interface ActorSystemProvider {
      * @return a ListenerRegistration instance to be used to unregister
      */
     ListenerRegistration<ActorSystemProviderListener> registerActorSystemProviderListener(
-            @Nonnull ActorSystemProviderListener listener);
+            @NonNull ActorSystemProviderListener listener);
 }
index 486891d..5ad195a 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.annotations.Beta;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 @Beta
 public final class NormalizedNodeInputOutput {
@@ -27,7 +27,7 @@ public final class NormalizedNodeInputOutput {
      * @return a new {@link NormalizedNodeDataInput} instance
      * @throws IOException if an error occurs reading from the input
      */
-    public static NormalizedNodeDataInput newDataInput(@Nonnull final DataInput input) throws IOException {
+    public static NormalizedNodeDataInput newDataInput(final @NonNull DataInput input) throws IOException {
         final byte marker = input.readByte();
         if (marker != TokenTypes.SIGNATURE_MARKER) {
             throw new InvalidNormalizedNodeStreamException(String.format("Invalid signature marker: %d", marker));
@@ -49,7 +49,7 @@ public final class NormalizedNodeInputOutput {
      * @param input the DataInput to read from
      * @return a new {@link NormalizedNodeDataInput} instance
      */
-    public static NormalizedNodeDataInput newDataInputWithoutValidation(@Nonnull final DataInput input) {
+    public static NormalizedNodeDataInput newDataInputWithoutValidation(final @NonNull DataInput input) {
         return new NormalizedNodeInputStreamReader(input, false);
     }
 
@@ -59,7 +59,7 @@ public final class NormalizedNodeInputOutput {
      * @param output the DataOutput to write to
      * @return a new {@link NormalizedNodeDataOutput} instance
      */
-    public static NormalizedNodeDataOutput newDataOutput(@Nonnull final DataOutput output) {
+    public static NormalizedNodeDataOutput newDataOutput(final @NonNull DataOutput output) {
         return new NormalizedNodeOutputStreamWriter(output);
     }
 }
index 8c81d60..ff20c0f 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.cluster.datastore.util;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Verify.verifyNotNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
 import java.util.Optional;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -34,19 +35,19 @@ public abstract class AbstractDataTreeModificationCursor implements DataTreeModi
     }
 
     @Override
-    public final void enter(@Nonnull final PathArgument child) {
+    public final void enter(final PathArgument child) {
         current = current.node(child);
     }
 
     @Override
-    public final void enter(@Nonnull final PathArgument... path) {
+    public final void enter(final PathArgument... path) {
         for (PathArgument arg : path) {
             enter(arg);
         }
     }
 
     @Override
-    public final void enter(@Nonnull final Iterable<PathArgument> path) {
+    public final void enter(final Iterable<PathArgument> path) {
         for (PathArgument arg : path) {
             enter(arg);
         }
@@ -54,25 +55,25 @@ public abstract class AbstractDataTreeModificationCursor implements DataTreeModi
 
     @Override
     public final void exit() {
-        Preconditions.checkState(!current.isEmpty());
-        current = Verify.verifyNotNull(current.getParent());
+        checkState(!current.isEmpty());
+        current = verifyNotNull(current.getParent());
     }
 
     @Override
     public final void exit(final int depth) {
-        Preconditions.checkArgument(depth >= 0);
+        checkArgument(depth >= 0);
 
         YangInstanceIdentifier next = current;
         for (int i = 0; i < depth; ++i) {
             next = next.getParent();
-            Preconditions.checkState(next != null);
+            checkState(next != null);
         }
 
         current = next;
     }
 
     @Override
-    public final Optional<NormalizedNode<?, ?>> readNode(@Nonnull final PathArgument child) {
+    public final Optional<NormalizedNode<?, ?>> readNode(final PathArgument child) {
         throw new UnsupportedOperationException("Not implemented");
     }
 
index 38249da..353a251 100644 (file)
@@ -22,10 +22,10 @@ import java.io.OutputStream;
 import java.nio.file.Files;
 import java.util.Iterator;
 import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -89,8 +89,7 @@ public class FileBackedOutputStream extends OutputStream {
      * @return a ByteSource instance
      * @throws IOException if close fails
      */
-    @Nonnull
-    public synchronized ByteSource asByteSource() throws IOException {
+    public synchronized @NonNull ByteSource asByteSource() throws IOException {
         close();
 
         if (source == null) {
index 4b7f854..297186d 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.RemovalNotification;
@@ -19,7 +21,7 @@ import java.io.ObjectInputStream;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.function.BiConsumer;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
 import org.opendaylight.yangtools.concepts.Identifier;
 import org.slf4j.Logger;
@@ -40,9 +42,9 @@ public final  class MessageAssembler implements AutoCloseable {
     private final String logContext;
 
     MessageAssembler(final Builder builder) {
-        this.fileBackedStreamFactory = Preconditions.checkNotNull(builder.fileBackedStreamFactory,
+        this.fileBackedStreamFactory = requireNonNull(builder.fileBackedStreamFactory,
                 "FiledBackedStreamFactory cannot be null");
-        this.assembledMessageCallback = Preconditions.checkNotNull(builder.assembledMessageCallback,
+        this.assembledMessageCallback = requireNonNull(builder.assembledMessageCallback,
                 "assembledMessageCallback cannot be null");
         this.logContext = builder.logContext;
 
@@ -94,7 +96,7 @@ public final  class MessageAssembler implements AutoCloseable {
      * @param sendTo the reference of the actor to which subsequent message slices should be sent
      * @return true if the message was handled, false otherwise
      */
-    public boolean handleMessage(final Object message, final @Nonnull ActorRef sendTo) {
+    public boolean handleMessage(final Object message, final @NonNull ActorRef sendTo) {
         if (message instanceof MessageSlice) {
             LOG.debug("{}: handleMessage: {}", logContext, message);
             onMessageSlice((MessageSlice) message, sendTo);
@@ -229,7 +231,7 @@ public final  class MessageAssembler implements AutoCloseable {
          * @return this Builder
          */
         public Builder fileBackedStreamFactory(final FileBackedOutputStreamFactory newFileBackedStreamFactory) {
-            this.fileBackedStreamFactory = Preconditions.checkNotNull(newFileBackedStreamFactory);
+            this.fileBackedStreamFactory = requireNonNull(newFileBackedStreamFactory);
             return this;
         }
 
@@ -255,7 +257,7 @@ public final  class MessageAssembler implements AutoCloseable {
          * @return this Builder
          */
         public Builder expireStateAfterInactivity(final long duration, final TimeUnit unit) {
-            Preconditions.checkArgument(duration > 0, "duration must be > 0");
+            checkArgument(duration > 0, "duration must be > 0");
             this.expireStateAfterInactivityDuration = duration;
             this.expireStateAfterInactivityUnit = unit;
             return this;
index ca2441e..57a6f9e 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.cluster.messaging;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.RemovalNotification;
@@ -20,7 +22,7 @@ import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.Predicate;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStream;
 import org.opendaylight.controller.cluster.io.FileBackedOutputStreamFactory;
 import org.opendaylight.yangtools.concepts.Identifier;
@@ -101,7 +103,7 @@ public class MessageSlicer implements AutoCloseable {
         if (message != null) {
             LOG.debug("{}: slice: identifier: {}, message: {}", logContext, identifier, message);
 
-            Preconditions.checkNotNull(fileBackedStreamFactory,
+            requireNonNull(fileBackedStreamFactory,
                     "The FiledBackedStreamFactory must be set in order to call this slice method");
 
             // Serialize the message to a FileBackedOutputStream.
@@ -204,7 +206,7 @@ public class MessageSlicer implements AutoCloseable {
      *
      * @param filter filters by Identifier
      */
-    public void cancelSlicing(@Nonnull final Predicate<Identifier> filter) {
+    public void cancelSlicing(final @NonNull Predicate<Identifier> filter) {
         stateCache.asMap().keySet().removeIf(
             messageSliceIdentifier -> filter.test(messageSliceIdentifier.getClientIdentifier()));
     }
@@ -334,7 +336,7 @@ public class MessageSlicer implements AutoCloseable {
          * @return this Builder
          */
         public Builder fileBackedStreamFactory(final FileBackedOutputStreamFactory newFileBackedStreamFactory) {
-            this.fileBackedStreamFactory = Preconditions.checkNotNull(newFileBackedStreamFactory);
+            this.fileBackedStreamFactory = requireNonNull(newFileBackedStreamFactory);
             return this;
         }
 
@@ -345,7 +347,7 @@ public class MessageSlicer implements AutoCloseable {
          * @return this Builder
          */
         public Builder messageSliceSize(final int newMessageSliceSize) {
-            Preconditions.checkArgument(newMessageSliceSize > 0, "messageSliceSize must be > 0");
+            checkArgument(newMessageSliceSize > 0, "messageSliceSize must be > 0");
             this.messageSliceSize = newMessageSliceSize;
             return this;
         }
@@ -358,7 +360,7 @@ public class MessageSlicer implements AutoCloseable {
          * @return this Builder
          */
         public Builder maxSlicingTries(final int newMaxSlicingTries) {
-            Preconditions.checkArgument(newMaxSlicingTries > 0, "newMaxSlicingTries must be > 0");
+            checkArgument(newMaxSlicingTries > 0, "newMaxSlicingTries must be > 0");
             this.maxSlicingTries = newMaxSlicingTries;
             return this;
         }
@@ -373,7 +375,7 @@ public class MessageSlicer implements AutoCloseable {
          * @return this Builder
          */
         public Builder expireStateAfterInactivity(final long duration, final TimeUnit unit) {
-