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 b79d3662f966b36aca51fd6fee3ba106cb951bd4..ebc697592348b2815b9de511f1bc639ff3bc0890 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 37343b9362533b55a100ff10127efd621b9416c7..b7953e4d6f2c413a719f66abd2dea824f7378f9f 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 b2801d052f3a0e595eaf0865e45974ae67ac80b9..b018fc493a386276f37abc5749b5b3aee26bcb15 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 de187bbe9b88cb3214478f71f66c2aaff5e8b5b2..b519af1b99581306e7d5418bd2de820db5659ef1 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 b476536b744b41d0cba493da91733092d504811a..3eddf3eb564f29c7b20b7ae06cec560793dc6144 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 e416fc63acaf847c2193af1a620bb4f1d89abc0f..0567ef119110f2841ebf6882edeb2a2a47578bb6 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 19df54628fe08e72d46ab46a11579b431ae13447..3898ee22b3e2d5b3972fd78a5fdc52b9278c49b2 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 fee3b03624abdd2591a7106f40b6aed309a3fefa..fa53a599aa1cbfa32dbdaac87b1a54339ee6cff9 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 5cff1a8f5cd9482f8bb330f49c524773d05f68d2..adef0c31bc022775889ad6d123954f6be955758d 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 be888e2e7e3b1bd78d76625c1993a65d359c31bd..ba86035e920a2356424bbdc37050d0eb2771907c 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 90eff1b227922f9892186df9a6acae40c2d2dc91..1ec81c8b5bd34fab0f26cee41928fff8fc1a2b9d 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 f5534a8fbcb9a82e133c10747c800101c135752a..ab2316c28edb63eb65b9f3d48b9cc8a9b99d869f 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 4eb5d1adc7e9c0e8aab35a0fd687ca4432793f87..92caa59b7acdeb641f4f655463e20876ba87ec2d 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 8a5916813629a00539d5d23f3ff4ea356181bd80..0367527a5e67eb2ce796720786df1adeae733f1d 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 28d09ed627748235b79f0a62635a73ec7b4273e3..e35936d53bdb01d5887f80510d14822978543748 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 f73453f9a44bfe0ca6c49c6dd61e2326d4d2b9b9..183766f31039fb0d3f56e103cba98027c4ee1e3b 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 b72b2b9f7c21bfecdf092e2f847e3991932d9ebd..c9edfdb05fb5fd6ab7d3750ab4c4bcf1cf1a1828 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 6a46f2359ed5d205aeb3b0c06061a65f20cf97f2..ecf792e1d9e13b3385c231828d71525fbb5f7ceb 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 95857e8393a1fd85e0146ab98b55f13650c99bbf..b6a7b4b260e4bb5ce1cb94c0302e25c6df53dc3a 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 8788c0df989e248d1eddad1be62b16a46237644a..2bc33cd1e4bc6c6ec5fc45271e48e941ccdbbfa1 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 5c8df7874163908f8869986e3db819dff9f0c3b2..093a3f1eb0c1cdedb4c957cfdb81c85b639ac6f2 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 4f2a0585da76c9afe04b0a5c744faf4c22138eba..7267edea4f5d19e7bc10137b37857c849e2200b2 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 13eb4bc618864b52c5ad46eec0783bf7bf72a092..db5a15b0bc57c5cda03bfd05ffaed53db7550024 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 65d43184cce42de55be52770015f6f77a4041ce6..9b60d21b0d2fc13b9aa391ac6460629f457c9d33 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 cc6188bd84d8a0032f6169d700aeb56bd8dbc0d5..f733a9e9199b31c1ed8b4afeb84549c8685bad78 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 5f96074fceec577f802595ab571f5390018fc38d..8fa0b627027166abbf207be2a3f63f2da481f840 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 2f56dd4aab19a2a013c1e59ed0164c7b0b80174e..733c3c7525041ee316e74264172df73976b39d4c 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 f80ae7c6aacc472f6da49204249be1aec713d5bc..4188a41fd5720894ffefc2351c2dd803d315352b 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 9f0bcbc25ff9f0e2849c912a093f1e732ae8bad1..a09d06c61f17e21977fd49566ba9430375fcfb6f 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 c32f7b2532cbe2d259357f5219b15835f941096a..03d4691cb44fe14eb05c33790632859c17d14b8f 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 fc633adaa6af4dc6e915f5528c43e28747d25ab9..5c5cda5bae0b8f7eb2e4bb02bd827e47c234c07b 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 6ede15bf407e83f4115c5827247c3ad781960dab..53c6bd92b194902048ce55a17926c6ff085ec54a 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 7e392af37570b4c735339276fb8586ff78d878c9..f85e8e244cd0884e687a589125ea62255930a521 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 c841f1350a0505c16ce180c05d7031dee09bd674..08735529d8f3276f2f6996eb109adc3112422c07 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 90af8cb2e11dfc0bc0f939901af3c73555d7a457..e5a949a31d04563da4e590109ae56e14ebcd8bd2 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 0d54235aa38b0866399c6ee82c5c1aa0a75f3a7a..5aa88a22c0de291cbba757139944edef4fb18ea0 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 d08b99a50f88b8e8c5432ec2bffed2e00fb7fd4c..2051e21d64cfe5efe178d8b5387b86e94ee1fa50 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 489539a68857fd2a5be0fa326d4a6311c73c1d56..4f5fd4e83e1bac0da0021b98eb81578dfacab7b4 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 785e2ef6ae86e1b154c447bc469b636c54582152..fa27d98e895b70699250027653c43ff3f0bcc434 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Convenience abstract base class for {@link CloseTracked} implementors.
index ef42c4025c6232494ff1f9a92048edfb7189ae5e..af77e18f5aca4ca1df3101e8d87e211533c8d7ed 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.trace.closetracker.impl;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * Object which can track where something has been created, and if it has been correctly "closed".
index 30e81c42df83c47f74a2fe0a28e27e84cadc8363..f96daaa425566f328540b1268f95ae1af08bd798 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 acd9f9154dda797ea23d2821f4bf83d2c64d3e25..a8f21f971955410a2d29342bb3e3e26ba231d8fe 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 7103a007680b1fe42db06eee13de17cbe64c976a..8291a72c2577157f629bde2c0c2b79034c62b259 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 f2ac8d5f449a8f782aa9bb1aed2f4be0218b4e7a..6c9e17b5bfbecba357171006e50811aba8a5551b 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 a1916f15002113c2e3a900b7b7be6cfa22c8b35c..a2bcc8a724f68ec05f2c9c57440084fb8368dcb6 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 8d6b965d9bc7950727b47104da5b9a7db42dc3f1..fb571f11f84179fcfe49ff78434b76daf012e945 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 932069edda42fe005a408607940f2989ab46ca26..53728043fb8fcdf1a7444f27886eef19bedcb16f 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 264f7a5d634dfae527dbe26860012e8356dbf2da..61aafef51354e88ab678dcfeb4f43970e308e636 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 ca3de5944b6c4c9c732230d495f12dfefd57bd42..a5f24990f6a54b4542bcc67dee35f2cdd4c56467 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 c7d81570c41b3fd8eb3c7d6e39b77ae263d46d7d..ac9be2562d2f0cafef031466439899bac990995b 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 6cbeda6098d2026225767d1564aae76109a1fa00..775ab0cdef376061df6677cdd2b7b760fa393139 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 aed050c3c04ee4e15afa9bb907d9887d556bb33f..b5f3afdc16839252f2f2069986e3ef5955c995ae 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 9c8fbe496cd96462b38fa798b0d3001943b5f4c5..634bbd4343fbba9219a8ab7a81c22c96c1ebf16c 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 5b27d50130a980891dbbbc2f072d0705fa3b8c9b..a572f308e5605a13a55576d5033000f985a2031a 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 e107be96c4652081c5c9e3876b6cce87b72c2505..1f9b93acd7e507f3f837f550697b1fde8eb67ee5 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 3a3511668c4bb82c7c216b56b5a89aa356521375..29641cb00e441d5dedc5e7cccccd69bb0b0e6d3a 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 a02b295dbc1ed7b39180d880c9b5eade21f78b54..8887a650c099e9c0427ca5f28db7922557f02bfc 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 71576f6d21b71fd02704e50d74e431f16a641f50..095e85cbe568ca3935c9a977af73c0564dea9370 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 764bce1ddb97aa4af14620736a5e286d64d1a87a..45b0b3898e20cc3b3a5acbe523944bbfc0ee6c6a 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 dd9445e749d3526c3484121232fec7e274b71194..8674ef4f2b910a26ac7eb76e90f9d594fe456ca0 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 7fec7e25f9399a0f6ce71ebf7dc60f43bb4e0eec..c9660d9a4a2405e8cb7dbea3abd7721816007264 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 f0e16a092a6505248062e628195aed80b0a8c8c2..552c7df22d8e10401384c993deb2988714d90f81 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 00ef63cf36fb76803c868a569f32e53057ae9d33..e4571c64a8dffd31cdbb0b09ed33f87f9f9b1d35 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 fd2fb686773d6caa292a352091ad9ab28f5c7eaf..c18b9d4b050827d5de8dc5bee55ff9318cc2a228 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 e8d58f253afe09a27cc79c07e306c258e1b35929..cdb94d44ee2914319ad9c652ccf8cde1e6e544cf 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 fbdfd49a3ff48c9c8eaee2012fbc2c7ff0460286..fef6cc8b7c57a142d683d1e0f27214ad751fd9d3 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 f6276a65e0863982cdd574122b9f1a4b5b44b3f8..4fa4dbfb57b34f620eecd6b82710dffc754cd88f 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 9ba39c2fcc456bf5b9a2ad528d411ef99e81abd6..17e42208850b5ce16a766819336f42213fc73662 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 eb49abc17aea4a0ebefacde0a5925312082e1405..21f823d08960b71111750120b3e451be7b7d4137 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 6b51c34e88ed6143e6c2e7a8c5c156266f83680f..ed02706f3e8c4747fb05fb0c6415aaa40f135127 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 90cec9db6c1ca479be13730ef2f410c1500e0976..b4b34437e844e7d160fbc7e4e7c77388172d334c 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 b0c36ace2b4174ae5f675a2c7200e7df2b435943..36c534654cabb80469c5035522805c351f354f37 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 d9298f95686162691329b61d88aadbf007cf7337..7ded55b3ce91686d93f26d1dafe9f15c2585a1c3 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 3f0cf43ac942238f814190af05a45bc3241712f1..d37b52cc69eb0f1f4dc4cf118234e5d95c7e5985 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 d77a0841489347ea69177e80764b7fa6a45dd049..67c6899231912df7a412e7e9f162736e8b689d99 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 3dc36934f40b2e31b8f709890c894d38426096cc..625d970ddfa5e5300d474d289eab79a470fa91b6 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 fe643d8af8e04df90ddc5ec5ec83de868e8e0f70..8a592292e2c936841a1d8df7ff1828bef411b449 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 ee4ac9d8830f3bca3afebd7c51f278d211a37a9b..080759f21851c0cb5cb04ee42bf37110446c9845 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 e9fc53afbe088d81dbdf7b4c6679453dcc2950f9..055984229bc2920a5cf1be0d609e2c8d12e0e53d 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 c419f7e0f2dcf672ce00831ccdf8fab1a6186761..6e1ca82f77d80571f74e6d4b49229ed02445ea98 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 28cc9b3f81e9226e2baf5e7ecd4422d9e20413ee..9c58e6b7ca10400614a7eec6a3a2585e97522153 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 7b240d7254f56083eabcbbb7d7c7f3a04ec74ffc..fa974b0ca42eee0b704df9afd1dd9ead437b18c9 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 b32b4f47285dd6973157c37d88adb6099f7a8675..039c15c8f4a374604085c02e9f85f0ad2f4ecd6c 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 c43d42c779401073aa0cedf19ec3ac2c6f9780e2..5448f798112a280e45088dde1ad8e9a14b3dd911 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 6d6bae100d319a72b7b66c840e904427d5e57cc8..222242e37c38e26cdca3e57ac1ed7386de5ac6f2 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 11697bfc85e3bfdc35125ba5ca8475b060843a6e..db44e5059c5b976ceefa8389b484ada150b2cd86 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 79b2a6d5268dd6b527d278bed3b5ce07c62370ec..94e1f8bfcb223329507de23cbfb05c48bbbf2204 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 374c185a1edc7b9d6f01baedefc04771042f313f..bd35c63a5a50eb08c8f6c5893f78ad8093fccc2b 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 992654e82728c95647932e2683fc197c64f3e448..40b8b8cac6970fe1c36f6886873a10e2bd255c74 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 5189e8fb4614ae2b0272abd9696da997796f5cc0..712d02517a8b068576771978106ce5aa9a433876 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 9e5b8ccf3d3d7224e36f05b27b0d83d0326aa36c..f749cb2fcaa2c18a9c5804acd398ff228768bd94 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 d70d2d6d247f5c0ae70217ecc690f60df03433f6..72ee08f38af6ac56eede7d332004dee1beede079 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 aa39016fdec6032e7d6c07ffc6ab037827155a17..d8ba10c8b67a7b2715d7309d1cf43bd5293eb979 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 9fa43abecf752aa8772024b1e4eb2c0d83056bc1..043501c76875a84a0e9a2ebc97dedb0b92468fea 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 ea3888e14d2287b7f7ff44d2fb8300691d67bd4c..d95674699f82e6a1de69fa0baddee064cf922905 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 dcb3b6b714150202bc4b68840b816a07a853d252..32e021037864a6262f09c1e74331e1789152bffe 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 486891dfd5e7328a7feb767852702fef43f5b627..5ad195a9b7cd207842a859ef6b78d139dc6f76f1 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 8c81d60819126bbe16e6a04e817ae66af101d3bf..ff20c0f631706adf444e68757d63e1b4d5cfb8e8 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 38249dabd4bee4bb33f356cdfc1b42cb326a6a77..353a25156cc4940613a8a2a1a55b7ef8fb6c41fc 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 75948830be824b081b35922c6cdeb89aaccd9e3a..f2d66470436ab482499c2861b776b1add446c756 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.io;
 
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * A factory for creating {@link FileBackedOutputStream} instances.
index 4b7f8546082aea5d49838aa15ae1eca34eb15da2..297186d9f7c6bd9f13f8c6bea68ae33274931836 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 ca2441e438064b34af1bd28c41b8fd93827de738..57a6f9ed4f44d48ffb2720126b32c21627222b3a 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) {
-            Preconditions.checkArgument(duration > 0, "duration must be > 0");
+            checkArgument(duration > 0, "duration must be > 0");
             this.expireStateAfterInactivityDuration = duration;
             this.expireStateAfterInactivityUnit = unit;
             return this;
@@ -386,7 +388,7 @@ public class MessageSlicer implements AutoCloseable {
          * @return this Builder
          */
         public Builder logContext(final String newLogContext) {
-            this.logContext = Preconditions.checkNotNull(newLogContext);
+            this.logContext = requireNonNull(newLogContext);
             return this;
         }
 
index 5de794d902d69976aeb0761939aebb4470269d9a..caa1a8debf53911bd2193c085c36a64a5aea2117 100644 (file)
@@ -7,10 +7,10 @@
  */
 package org.opendaylight.controller.cluster.notifications;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import static java.util.Objects.requireNonNull;
 
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 
 /**
  * A local message initiated internally from the RaftActor when some state of a leader has changed.
@@ -22,13 +22,13 @@ public class LeaderStateChanged {
     private final String leaderId;
     private final short leaderPayloadVersion;
 
-    public LeaderStateChanged(@Nonnull String memberId, @Nullable String leaderId, short leaderPayloadVersion) {
-        this.memberId = Preconditions.checkNotNull(memberId);
+    public LeaderStateChanged(@NonNull String memberId, @Nullable String leaderId, short leaderPayloadVersion) {
+        this.memberId = requireNonNull(memberId);
         this.leaderId = leaderId;
         this.leaderPayloadVersion = leaderPayloadVersion;
     }
 
-    public @Nonnull String getMemberId() {
+    public @NonNull String getMemberId() {
         return memberId;
     }
 
index 1ceba1cd1320e9790e99f44a046e0522d592c319..76babc15db7d831403e985c658e3a3cef46f3e99 100644 (file)
@@ -44,7 +44,7 @@ import java.util.concurrent.Callable;
 import java.util.stream.Collector;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.ExecutionContext;
@@ -271,12 +271,11 @@ public class LocalSnapshotStore extends SnapshotStore {
                 .filter(criteria::matches).collect(Collectors.toList());
     }
 
-    private static Stream<SnapshotMetadata> toStream(@Nullable final SnapshotMetadata md) {
+    private static Stream<SnapshotMetadata> toStream(final @Nullable SnapshotMetadata md) {
         return md != null ? Stream.of(md) : Stream.empty();
     }
 
-    @Nullable
-    private static SnapshotMetadata extractMetadata(final File file) {
+    private static @Nullable SnapshotMetadata extractMetadata(final File file) {
         String name = file.getName();
         int sequenceNumberEndIndex = name.lastIndexOf('-');
         int persistenceIdEndIndex = name.lastIndexOf('-', sequenceNumberEndIndex - 1);
index 3401fdfd9a2ad2299c49da2a8b3533d42fbc7013..03b44b585129e97f199310b955272c57e8a055e8 100644 (file)
@@ -5,12 +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.schema.provider;
 
 import com.google.common.annotations.Beta;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.cluster.schema.provider.impl.YangTextSchemaSourceSerializationProxy;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import scala.concurrent.Future;
@@ -23,5 +22,5 @@ public interface RemoteYangTextSourceProvider {
 
     Future<Set<SourceIdentifier>> getProvidedSources();
 
-    Future<YangTextSchemaSourceSerializationProxy> getYangTextSchemaSource(@Nonnull SourceIdentifier identifier);
+    Future<YangTextSchemaSourceSerializationProxy> getYangTextSchemaSource(@NonNull SourceIdentifier identifier);
 }
index eeab236ed9e91b85e951c295f06b68488b2c41b6..5e88952dda26f2e2ad670c202f6f67b0e795e965 100644 (file)
@@ -5,18 +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.schema.provider.impl;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.io.IOException;
 import java.util.Set;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.schema.provider.RemoteYangTextSourceProvider;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
@@ -38,7 +37,7 @@ public class RemoteYangTextSourceProviderImpl implements RemoteYangTextSourcePro
 
     public RemoteYangTextSourceProviderImpl(final SchemaRepository repository,
             final Set<SourceIdentifier> providedSources) {
-        this.repository = Preconditions.checkNotNull(repository);
+        this.repository = requireNonNull(repository);
         this.providedSources = providedSources;
     }
 
@@ -57,7 +56,7 @@ public class RemoteYangTextSourceProviderImpl implements RemoteYangTextSourcePro
 
         Futures.addCallback(future, new FutureCallback<YangTextSchemaSource>() {
             @Override
-            public void onSuccess(@Nonnull final YangTextSchemaSource result) {
+            public void onSuccess(final YangTextSchemaSource result) {
                 try {
                     promise.success(new YangTextSchemaSourceSerializationProxy(result));
                 } catch (IOException e) {
index a847807b59f44617b1bd5ff0a4074ff7ba0ce195..7c0a7773f1d60f2a8c26d1ef99795396f7696270 100644 (file)
@@ -16,7 +16,6 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.function.Function;
-import javax.annotation.Nonnull;
 
 /**
  * An implementation of CheckedFuture that provides similar behavior for the <code>get</code> methods
@@ -56,7 +55,7 @@ public final class MappingCheckedFuture<V, X extends Exception> extends Abstract
 
     @Override
     @SuppressWarnings("checkstyle:parameterName")
-    protected X mapException(@Nonnull final Exception e) {
+    protected X mapException(final Exception e) {
         return mapper.apply(e);
     }
 
@@ -79,7 +78,7 @@ public final class MappingCheckedFuture<V, X extends Exception> extends Abstract
     }
 
     @Override
-    public V get(final long timeout, @Nonnull final TimeUnit unit)
+    public V get(final long timeout, final TimeUnit unit)
             throws InterruptedException, ExecutionException, TimeoutException {
         try {
             return super.get(timeout, unit);
index bc18e91582373783ac2499819164aa7935e7b5cb..70789ccb1481c36e8179999d341a0bdddecd47b8 100644 (file)
@@ -11,7 +11,6 @@ import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
-import javax.annotation.CheckReturnValue;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.MappingCheckedFuture;
 import org.opendaylight.mdsal.common.api.CommitInfo;
@@ -339,7 +338,6 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      * @deprecated Use {@link #commit()} instead.
      */
     @Deprecated
-    @CheckReturnValue
     default CheckedFuture<Void, TransactionCommitFailedException> submit() {
         return MappingCheckedFuture.create(commit().transform(ignored -> null, MoreExecutors.directExecutor()),
                 SUBMIT_EXCEPTION_MAPPER);
@@ -374,7 +372,6 @@ public interface AsyncWriteTransaction<P extends Path<P>, D> extends AsyncTransa
      *         {@link TransactionCommitFailedException} or an exception derived from TransactionCommitFailedException.
      * @throws IllegalStateException if the transaction is already committed or was canceled.
      */
-    @CheckReturnValue
     @NonNull FluentFuture<? extends @NonNull CommitInfo> commit();
 
     /**
index 8b8b0b87a17227b5d5623bc0694b61a5fb0ba59f..0ce05ebd1e315b05ed91c521b2a7569809fa12eb 100644 (file)
@@ -5,13 +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.md.sal.common.util.jmx;
 
 import com.google.common.annotations.Beta;
 import java.lang.management.ManagementFactory;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanRegistrationException;
@@ -19,6 +16,8 @@ import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectName;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,7 +52,7 @@ public abstract class AbstractMXBean {
      * @param beanType Used as the <code>type</code> property in the bean's ObjectName.
      * @param beanCategory Used as the <code>Category</code> property in the bean's ObjectName.
      */
-    protected AbstractMXBean(@Nonnull String beanName, @Nonnull String beanType,
+    protected AbstractMXBean(@NonNull String beanName, @NonNull String beanType,
             @Nullable String beanCategory) {
         this.beanName = beanName;
         this.beanType = beanType;
index 47a0cc84ccf4db96b97b04c30f49d95003e43ec9..2323e2d541c26bddf72cbe6a0155c2e159df4aaf 100644 (file)
@@ -5,15 +5,15 @@
  * 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.common.util.jmx;
 
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Executor;
 import java.util.concurrent.RejectedExecutionHandler;
 import java.util.concurrent.ThreadPoolExecutor;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.util.concurrent.CountingRejectedExecutionHandler;
 import org.opendaylight.yangtools.util.concurrent.TrackingLinkedBlockingQueue;
 import org.slf4j.Logger;
@@ -39,9 +39,9 @@ public class ThreadExecutorStatsMXBeanImpl extends AbstractMXBean
      * @param beanCategory Used as the <code>Category</code> property in the bean's ObjectName.
      */
     public ThreadExecutorStatsMXBeanImpl(final ThreadPoolExecutor executor, final String beanName,
-            final String beanType, @Nullable final String beanCategory) {
+            final String beanType, final @Nullable String beanCategory) {
         super(beanName, beanType, beanCategory);
-        this.executor = Preconditions.checkNotNull(executor);
+        this.executor = requireNonNull(executor);
     }
 
     private static ThreadExecutorStatsMXBeanImpl createInternal(final Executor executor,
@@ -67,7 +67,7 @@ public class ThreadExecutorStatsMXBeanImpl extends AbstractMXBean
      *         is a ThreadPoolExecutor, otherwise null.
      */
     public static ThreadExecutorStatsMXBeanImpl create(final Executor executor, final String beanName,
-            final String beanType, @Nullable final String beanCategory) {
+            final String beanType, final @Nullable String beanCategory) {
         ThreadExecutorStatsMXBeanImpl ret = createInternal(executor, beanName, beanType, beanCategory);
         if (ret != null) {
             ret.registerMBean();
index da328566a040bb6797f41a7536afe60233c692d7..4580bb9888d6da6a75d475e20a62aedbb4bbc7b5 100644 (file)
@@ -8,6 +8,9 @@
 package org.opendaylight.controller.cluster.sharding;
 
 import static akka.actor.ActorRef.noSender;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
 
 import akka.actor.ActorRef;
 import akka.actor.PoisonPill;
@@ -16,11 +19,9 @@ import akka.dispatch.Mapper;
 import akka.dispatch.OnComplete;
 import akka.util.Timeout;
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import java.util.Collection;
 import java.util.concurrent.CompletionStage;
 import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.cluster.datastore.exceptions.LocalShardNotFoundException;
 import org.opendaylight.controller.cluster.datastore.messages.MakeLeaderLocal;
 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
@@ -36,7 +37,6 @@ import org.slf4j.LoggerFactory;
 import scala.compat.java8.FutureConverters;
 import scala.concurrent.Future;
 
-
 /**
  * Default {@link CDSShardAccess} implementation. Listens on leader location
  * change events and distributes them to registered listeners. Also updates
@@ -65,8 +65,8 @@ final class CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener
     private volatile boolean closed = false;
 
     CDSShardAccessImpl(final DOMDataTreeIdentifier prefix, final ActorContext actorContext) {
-        this.prefix = Preconditions.checkNotNull(prefix);
-        this.actorContext = Preconditions.checkNotNull(actorContext);
+        this.prefix = requireNonNull(prefix);
+        this.actorContext = requireNonNull(actorContext);
         this.makeLeaderLocalTimeout =
                 new Timeout(actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().$times(2));
 
@@ -74,26 +74,23 @@ final class CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener
         // TODO Maybe we should do this in async
         final Optional<ActorRef> localShardReply =
                 actorContext.findLocalShard(ClusterUtils.getCleanShardName(prefix.getRootIdentifier()));
-        Preconditions.checkState(localShardReply.isPresent(),
+        checkState(localShardReply.isPresent(),
                 "Local shard for {} not present. Cannot register RoleChangeListenerActor", prefix);
         roleChangeListenerActor =
                 actorContext.getActorSystem().actorOf(RoleChangeListenerActor.props(localShardReply.get(), this));
     }
 
     private void checkNotClosed() {
-        Preconditions.checkState(!closed,
-                "CDSDataTreeProducer, that this CDSShardAccess is associated with, is no longer valid");
+        checkState(!closed, "CDSDataTreeProducer, that this CDSShardAccess is associated with, is no longer valid");
     }
 
     @Override
-    @Nonnull
     public DOMDataTreeIdentifier getShardIdentifier() {
         checkNotClosed();
         return prefix;
     }
 
     @Override
-    @Nonnull
     public LeaderLocation getLeaderLocation() {
         checkNotClosed();
         // TODO before getting first notification from roleChangeListenerActor
@@ -102,7 +99,6 @@ final class CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener
     }
 
     @Override
-    @Nonnull
     public CompletionStage<Void> makeLeaderLocal() {
         // TODO when we have running make leader local operation
         // we should just return the same completion stage
@@ -157,13 +153,12 @@ final class CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener
     }
 
     @Override
-    @Nonnull
     public <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L>
-            registerLeaderLocationListener(@Nonnull final L listener) {
+            registerLeaderLocationListener(final L listener) {
         checkNotClosed();
-        Preconditions.checkNotNull(listener);
-        Preconditions.checkArgument(!listeners.contains(listener),
-                "Listener {} is already registered with ShardAccess {}", listener, this);
+        requireNonNull(listener);
+        checkArgument(!listeners.contains(listener), "Listener %s is already registered with ShardAccess %s", listener,
+            this);
 
         LOG.debug("Registering LeaderLocationListener {}", listener);
 
@@ -184,7 +179,7 @@ final class CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener
 
     @Override
     @SuppressWarnings("checkstyle:IllegalCatch")
-    public void onLeaderLocationChanged(@Nonnull final LeaderLocation location) {
+    public void onLeaderLocationChanged(final LeaderLocation location) {
         if (closed) {
             // we are closed already. Do not dispatch any new leader location
             // change events.
index ce51aa3ab0c4aee93d60c6f6deea60c7557af929..53ced96400b0b15f39fa2ac848033f5c9086ecad 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.api;
 
 import java.util.Collection;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
 
 /**
@@ -46,5 +46,5 @@ public interface DOMDataTreeChangeListener extends EventListener {
      *
      * @param changes Collection of change events, may not be null or empty.
      */
-    void onDataTreeChanged(@Nonnull Collection<DataTreeCandidate> changes);
+    void onDataTreeChanged(@NonNull Collection<DataTreeCandidate> changes);
 }
index 46a6fb2cb7ccf6bf140689ce6ed10ecf715df1bd..28590fc606736dd6863858e817f14cb2b3bdf3f0 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.md.sal.dom.api;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 
 /**
@@ -53,6 +53,6 @@ public interface DOMDataTreeChangeService extends DOMDataBrokerExtension {
      *         your listener using {@link ListenerRegistration#close()} to stop
      *         delivery of change events.
      */
-    @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
-            @Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener);
+    @NonNull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
+            @NonNull DOMDataTreeIdentifier treeId, @NonNull L listener);
 }
index f9a96baeee69cf116da4488e9dae4ec048c25ba1..9ed435a627e64b432f894acd3aead1c8d8792959 100644 (file)
@@ -5,14 +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.dom.api;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.io.Serializable;
 import java.util.Iterator;
-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;
@@ -26,13 +26,13 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 public final class DOMDataTreeIdentifier implements Immutable,
         Path<DOMDataTreeIdentifier>, Serializable, Comparable<DOMDataTreeIdentifier> {
     private static final long serialVersionUID = 1L;
-    private final YangInstanceIdentifier rootIdentifier;
-    private final LogicalDatastoreType datastoreType;
+    private final @NonNull YangInstanceIdentifier rootIdentifier;
+    private final @NonNull LogicalDatastoreType datastoreType;
 
     public DOMDataTreeIdentifier(final LogicalDatastoreType datastoreType,
             final YangInstanceIdentifier rootIdentifier) {
-        this.datastoreType = Preconditions.checkNotNull(datastoreType);
-        this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier);
+        this.datastoreType = requireNonNull(datastoreType);
+        this.rootIdentifier = requireNonNull(rootIdentifier);
     }
 
     /**
@@ -59,7 +59,7 @@ public final class DOMDataTreeIdentifier implements Immutable,
      *
      * @return Logical data store type. Guaranteed to be non-null.
      */
-    public @Nonnull LogicalDatastoreType getDatastoreType() {
+    public @NonNull LogicalDatastoreType getDatastoreType() {
         return datastoreType;
     }
 
@@ -68,7 +68,7 @@ public final class DOMDataTreeIdentifier implements Immutable,
      *
      * @return Instance identifier corresponding to the root node.
      */
-    public @Nonnull YangInstanceIdentifier getRootIdentifier() {
+    public @NonNull YangInstanceIdentifier getRootIdentifier() {
         return rootIdentifier;
     }
 
index e3dadf74143245cfa9125744f06011789ad42138..1f2c4968c443cf682f371162e73d2d02070aea6d 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.api;
 
 import com.google.common.annotations.Beta;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Marker interface for services which can support {@link DOMServiceExtension}.
@@ -28,5 +28,5 @@ public interface DOMExtensibleService<T extends DOMExtensibleService<T, E>,
      *
      * @return A map of supported functionality.
      */
-    @Nonnull Map<Class<? extends E>, E> getSupportedExtensions();
+    @NonNull Map<Class<? extends E>, E> getSupportedExtensions();
 }
index 7085588e8796d029561d440503ff561d3e20b584..bd5355f8c154b1cb9ebd702f8890211f52c1fe82 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Interface implemented by listeners interested in {@link DOMNotification}s.
@@ -20,5 +20,5 @@ public interface DOMNotificationListener extends EventListener {
      *
      * @param notification Received notification
      */
-    void onNotification(@Nonnull DOMNotification notification);
+    void onNotification(@NonNull DOMNotification notification);
 }
index 852dc560755c736c911a69ec0733b1df40f218ed..08cb25b36db6abcf143274be908d3be4769e3757 100644 (file)
@@ -10,8 +10,7 @@ package org.opendaylight.controller.md.sal.dom.api;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnegative;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A {@link DOMService} which allows its user to send {@link DOMNotification}s. It
@@ -80,7 +79,7 @@ public interface DOMNotificationPublishService extends DOMService {
      * @throws InterruptedException if interrupted while waiting
      * @throws NullPointerException if notification is null.
      */
-    @Nonnull ListenableFuture<?> putNotification(@Nonnull DOMNotification notification) throws InterruptedException;
+    @NonNull ListenableFuture<?> putNotification(@NonNull DOMNotification notification) throws InterruptedException;
 
     /**
      * Attempt to publish a notification. The result of this method is a {@link ListenableFuture}
@@ -97,7 +96,7 @@ public interface DOMNotificationPublishService extends DOMService {
      *         the implementation from accepting the notification for delivery.
      * @throws NullPointerException if notification is null.
      */
-    @Nonnull ListenableFuture<?> offerNotification(@Nonnull DOMNotification notification);
+    @NonNull ListenableFuture<?> offerNotification(@NonNull DOMNotification notification);
 
     /**
      * Attempt to publish a notification. The result of this method is a {@link ListenableFuture}
@@ -108,7 +107,7 @@ public interface DOMNotificationPublishService extends DOMService {
      * is guaranteed to block more than the specified timeout.
      *
      * @param notification Notification to be published.
-     * @param timeout how long to wait before giving up, in units of unit
+     * @param timeout how long to wait before giving up, in units of unit, must not be negative
      * @param unit a TimeUnit determining how to interpret the timeout parameter
      * @return A listenable future which will report completion when the service
      *         has finished propagating the notification to its immediate registrants,
@@ -118,6 +117,6 @@ public interface DOMNotificationPublishService extends DOMService {
      * @throws NullPointerException if notification or unit is null.
      * @throws IllegalArgumentException if timeout is negative.
      */
-    @Nonnull ListenableFuture<?> offerNotification(@Nonnull DOMNotification notification,
-        @Nonnegative long timeout, @Nonnull TimeUnit unit) throws InterruptedException;
+    @NonNull ListenableFuture<?> offerNotification(@NonNull DOMNotification notification,
+        long timeout, @NonNull TimeUnit unit) throws InterruptedException;
 }
index 37d3a019a628dcb5a9bfc52ccbbbb8741fdfa7ae..1e4625bb2c73e9defbd02215015e606f7c5fa3f4 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
@@ -35,7 +35,7 @@ public interface DOMNotificationService extends DOMService {
      * @throws NullPointerException if either of the arguments is null
      */
     <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(
-            @Nonnull T listener, @Nonnull Collection<SchemaPath> types);
+            @NonNull T listener, @NonNull Collection<SchemaPath> types);
 
     /**
      * Register a {@link DOMNotificationListener} to receive a set of notifications. As with
@@ -53,5 +53,5 @@ public interface DOMNotificationService extends DOMService {
      */
     // FIXME: Java 8: provide a default implementation of this method.
     <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(
-            @Nonnull T listener, SchemaPath... types);
+            @NonNull T listener, SchemaPath... types);
 }
index a62f79db0bf71c1b1baf6019053154f9a99528a6..2131cf16340e097226b3b9ec2274978896f5a036 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.api;
 
 import java.util.Collection;
 import java.util.EventListener;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * An {@link EventListener} used to track RPC implementations becoming (un)available a {@link DOMRpcService}. Note that
@@ -54,14 +54,14 @@ public interface DOMRpcAvailabilityListener extends EventListener {
      *
      * @param rpcs RPC types newly available
      */
-    void onRpcAvailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+    void onRpcAvailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
 
     /**
      * Method invoked whenever an RPC type becomes unavailable.
      *
      * @param rpcs RPC types which became unavailable
      */
-    void onRpcUnavailable(@Nonnull Collection<DOMRpcIdentifier> rpcs);
+    void onRpcUnavailable(@NonNull Collection<DOMRpcIdentifier> rpcs);
 
     /**
      * Implementation filtering method. This method is useful for forwarding RPC implementations,
index 63e646debd7a884699c73ff4fb881d851ec8892e..a574564c0a682c28861f06db5e5ad7ad89fb517a 100644 (file)
@@ -7,11 +7,12 @@
  */
 package org.opendaylight.controller.md.sal.dom.api;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import java.util.Objects;
-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.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
@@ -24,7 +25,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 public abstract class DOMRpcIdentifier {
 
     private static final class Global extends DOMRpcIdentifier {
-        private Global(final @Nonnull SchemaPath type) {
+        private Global(final @NonNull SchemaPath type) {
             super(type);
         }
 
@@ -37,9 +38,9 @@ public abstract class DOMRpcIdentifier {
     private static final class Local extends DOMRpcIdentifier {
         private final YangInstanceIdentifier contextReference;
 
-        private Local(final @Nonnull SchemaPath type, final @Nonnull YangInstanceIdentifier contextReference) {
+        private Local(final @NonNull SchemaPath type, final @NonNull YangInstanceIdentifier contextReference) {
             super(type);
-            this.contextReference = Preconditions.checkNotNull(contextReference);
+            this.contextReference = requireNonNull(contextReference);
         }
 
         @Override
@@ -51,7 +52,7 @@ public abstract class DOMRpcIdentifier {
     private final SchemaPath type;
 
     private DOMRpcIdentifier(final SchemaPath type) {
-        this.type = Preconditions.checkNotNull(type);
+        this.type = requireNonNull(type);
     }
 
     /**
@@ -60,7 +61,7 @@ public abstract class DOMRpcIdentifier {
      * @param type RPC type, SchemaPath of its definition, may not be null
      * @return A global RPC identifier, guaranteed to be non-null.
      */
-    public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type) {
+    public static @NonNull DOMRpcIdentifier create(final @NonNull SchemaPath type) {
         return new Global(type);
     }
 
@@ -71,7 +72,7 @@ public abstract class DOMRpcIdentifier {
      * @param contextReference Context reference, null means a global RPC identifier.
      * @return A global RPC identifier, guaranteed to be non-null.
      */
-    public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type,
+    public static @NonNull DOMRpcIdentifier create(final @NonNull SchemaPath type,
             final @Nullable YangInstanceIdentifier contextReference) {
         if (contextReference == null || contextReference.isEmpty()) {
             return new Global(type);
@@ -92,7 +93,7 @@ public abstract class DOMRpcIdentifier {
      *
      * @return RPC type.
      */
-    public final @Nonnull SchemaPath getType() {
+    public final @NonNull SchemaPath getType() {
         return type;
     }
 
@@ -101,7 +102,7 @@ public abstract class DOMRpcIdentifier {
      *
      * @return RPC context reference.
      */
-    public abstract @Nonnull YangInstanceIdentifier getContextReference();
+    public abstract @NonNull YangInstanceIdentifier getContextReference();
 
     @Override
     public final int hashCode() {
index 448cbd4cc3337cfde232faa4a094ad5a9418c3fa..540f50b7cd555119f85d4279a3283d0fbfa91a98 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import com.google.common.util.concurrent.CheckedFuture;
-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.data.api.schema.NormalizedNode;
 
 /**
@@ -27,7 +27,7 @@ public interface DOMRpcImplementation {
      *         or report a subclass of {@link DOMRpcException} reporting a transport
      *         error.
      */
-    @Nonnull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull DOMRpcIdentifier rpc,
+    @NonNull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@NonNull DOMRpcIdentifier rpc,
             @Nullable NormalizedNode<?, ?> input);
 
     /**
index 2858255faa96044501be2092cf5b7f04691b8ac7..a856607ca97d3f44193ef2b82556f23d8f2e70d8 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.md.sal.dom.api;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * Exception indicating that no implementation of the requested RPC service is available.
@@ -16,13 +17,13 @@ import javax.annotation.Nonnull;
 public class DOMRpcImplementationNotAvailableException extends DOMRpcException {
     private static final long serialVersionUID = 1L;
 
-    public DOMRpcImplementationNotAvailableException(@Nonnull final String format, final Object... args) {
+    public DOMRpcImplementationNotAvailableException(final @NonNull String format, final Object... args) {
         super(String.format(format, args));
     }
 
-    public DOMRpcImplementationNotAvailableException(@Nonnull final Throwable cause, @Nonnull final String format,
+    public DOMRpcImplementationNotAvailableException(final @NonNull Throwable cause, final @NonNull String format,
             final Object... args) {
-        super(String.format(format, args), Preconditions.checkNotNull(cause));
+        super(String.format(format, args), requireNonNull(cause));
     }
 
     public DOMRpcImplementationNotAvailableException(final String message, final Throwable cause) {
index 9454214650e3cae7746add70077e95282f91e0a5..2d0c1368f5eda9d12dca6019cb5fd10ecc7afabd 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 /**
  * A {@link DOMService} which allows registration of RPC implementations with a conceptual router. The client
@@ -43,8 +43,8 @@ public interface DOMRpcProviderService extends DOMService {
      * @throws NullPointerException if implementation or types is null
      * @throws IllegalArgumentException if types is empty or contains a null element.
      */
-    @Nonnull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
-            @Nonnull T implementation, @Nonnull DOMRpcIdentifier... rpcs);
+    @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
+            @NonNull T implementation, @NonNull DOMRpcIdentifier... rpcs);
 
     /**
      * Register an {@link DOMRpcImplementation} object with this service.
@@ -55,6 +55,6 @@ public interface DOMRpcProviderService extends DOMService {
      * @throws NullPointerException if implementation or types is null
      * @throws IllegalArgumentException if types is empty or contains a null element.
      */
-    @Nonnull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
-            @Nonnull T implementation, @Nonnull Set<DOMRpcIdentifier> rpcs);
+    @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
+            @NonNull T implementation, @NonNull Set<DOMRpcIdentifier> rpcs);
 }
index e8826de060d48d82a4c8a9f26d36f47611a2a368..870fe82ba4fe45c6ce8d1e58213808d44bf5fa8b 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.controller.md.sal.dom.api;
 
 import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -34,7 +34,7 @@ public interface DOMRpcService extends DOMService {
      *         or report a subclass of {@link DOMRpcException} reporting a transport
      *         error.
      */
-    @Nonnull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull SchemaPath type,
+    @NonNull CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@NonNull SchemaPath type,
             @Nullable NormalizedNode<?, ?> input);
 
     /**
@@ -56,5 +56,5 @@ public interface DOMRpcService extends DOMService {
      *         a {@link ListenerRegistration#close()} will cancel it. Returned object
      *         is guaranteed to be non-null.
      */
-    @Nonnull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@Nonnull T listener);
+    @NonNull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@NonNull T listener);
 }
index 2695e64c86e6032d4fdbe30f26254466b2fcf7aa..28e4d9b753a942cb3c302b1dcdd5fa0a44e75376 100755 (executable)
@@ -15,7 +15,6 @@ import java.util.EnumMap;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicLong;
-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.DOMDataBroker;
@@ -54,11 +53,9 @@ public abstract class AbstractDOMDataBroker extends AbstractDOMForwardedTransact
         if (treeChange) {
             extensions = ImmutableMap.<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension>of(
                     DOMDataTreeChangeService.class, new DOMDataTreeChangeService() {
-                        @Nonnull
                         @Override
                         public <L extends DOMDataTreeChangeListener> ListenerRegistration<L>
-                            registerDataTreeChangeListener(
-                                    @Nonnull final DOMDataTreeIdentifier treeId, @Nonnull final L listener) {
+                            registerDataTreeChangeListener(final DOMDataTreeIdentifier treeId, final L listener) {
                                 DOMStore publisher = getTxFactories().get(treeId.getDatastoreType());
                                 checkState(publisher != null,
                                            "Requested logical data store is not available.");
@@ -95,7 +92,6 @@ public abstract class AbstractDOMDataBroker extends AbstractDOMForwardedTransact
         return "DOM-" + txNum.getAndIncrement();
     }
 
-    @Nonnull
     @Override
     public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
         return extensions;
index 1a7587b3c59d0370bd6341d0d581b5b19694f2b7..de8a754a0b4c1db03e68cdebc5ba49509126e1e2 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
-import com.google.common.base.Preconditions;
-import javax.annotation.Nonnull;
+import static java.util.Objects.requireNonNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
@@ -35,8 +36,8 @@ public final class PingPongDataBroker extends ForwardingDOMDataBroker implements
      *
      * @param delegate Backend broker, may not be null.
      */
-    public PingPongDataBroker(@Nonnull final DOMDataBroker delegate) {
-        this.delegate = Preconditions.checkNotNull(delegate);
+    public PingPongDataBroker(final @NonNull DOMDataBroker delegate) {
+        this.delegate = requireNonNull(delegate);
     }
 
     @Override
index adcf8aaf382ba859df7d7788cae729a52f3da20d..af474c5c56c5370e9d6b2c7845e42a27d8984ea7 100644 (file)
@@ -7,9 +7,11 @@
  */
 package org.opendaylight.controller.md.sal.dom.broker.impl;
 
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.base.Verify.verify;
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
@@ -18,8 +20,8 @@ import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Map.Entry;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -97,7 +99,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
     private volatile PingPongTransaction inflightTx;
 
     PingPongTransactionChain(final DOMDataBroker broker, final TransactionChainListener listener) {
-        this.listener = Preconditions.checkNotNull(listener);
+        this.listener = requireNonNull(listener);
         this.delegate = broker.createTransactionChain(new TransactionChainListener() {
             @Override
             public void onTransactionChainFailed(final TransactionChain<?, ?> chain,
@@ -163,7 +165,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
     }
 
     private synchronized PingPongTransaction slowAllocateTransaction() {
-        Preconditions.checkState(shutdownTx == null, "Transaction chain %s has been shut down", this);
+        checkState(shutdownTx == null, "Transaction chain %s has been shut down", this);
 
         if (deadTx != null) {
             throw new IllegalStateException(
@@ -225,7 +227,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
      * @param tx Transaction which needs processing.
      */
     @GuardedBy("this")
-    private void processTransaction(@Nonnull final PingPongTransaction tx) {
+    private void processTransaction(final @NonNull PingPongTransaction tx) {
         if (failed) {
             LOG.debug("Cancelling transaction {}", tx);
             tx.getTransaction().cancel();
@@ -273,7 +275,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
      */
     private synchronized void processNextTransaction(final PingPongTransaction tx) {
         final boolean success = INFLIGHT_UPDATER.compareAndSet(this, tx, null);
-        Preconditions.checkState(success, "Completed transaction %s while %s was submitted", tx, inflightTx);
+        checkState(success, "Completed transaction %s while %s was submitted", tx, inflightTx);
 
         final PingPongTransaction nextTx = READY_UPDATER.getAndSet(this, null);
         if (nextTx != null) {
@@ -299,10 +301,10 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
         processNextTransaction(tx);
     }
 
-    void readyTransaction(@Nonnull final PingPongTransaction tx) {
+    void readyTransaction(final @NonNull PingPongTransaction tx) {
         // First mark the transaction as not locked.
         final boolean lockedMatch = LOCKED_UPDATER.compareAndSet(this, tx, null);
-        Preconditions.checkState(lockedMatch, "Attempted to submit transaction %s while we have %s", tx, lockedTx);
+        checkState(lockedMatch, "Attempted to submit transaction %s while we have %s", tx, lockedTx);
         LOG.debug("Transaction {} unlocked", tx);
 
         /*
@@ -310,7 +312,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
          * or a background transaction completion callback.
          */
         final boolean success = READY_UPDATER.compareAndSet(this, null, tx);
-        Preconditions.checkState(success, "Transaction %s collided on ready state", tx, readyTx);
+        checkState(success, "Transaction %s collided on ready state", tx, readyTx);
         LOG.debug("Transaction {} readied", tx);
 
         /*
@@ -338,7 +340,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
     synchronized void cancelTransaction(final PingPongTransaction tx, final DOMDataReadWriteTransaction frontendTx) {
         // Attempt to unlock the operation.
         final boolean lockedMatch = LOCKED_UPDATER.compareAndSet(this, tx, null);
-        Verify.verify(lockedMatch, "Cancelling transaction %s collided with locked transaction %s", tx, lockedTx);
+        verify(lockedMatch, "Cancelling transaction %s collided with locked transaction %s", tx, lockedTx);
 
         // Cancel the backend transaction, so we do not end up leaking it.
         final boolean backendCancelled = tx.getTransaction().cancel();
@@ -374,12 +376,11 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
     @Override
     public synchronized void close() {
         final PingPongTransaction notLocked = lockedTx;
-        Preconditions
-                .checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", notLocked);
+        checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", notLocked);
 
         // This is not reliable, but if we observe it to be null and the process has already completed,
         // the backend transaction chain will throw the appropriate error.
-        Preconditions.checkState(shutdownTx == null, "Attempted to close an already-closed chain");
+        checkState(shutdownTx == null, "Attempted to close an already-closed chain");
 
         // This may be a reaction to our failure callback, in that case the backend is already shutdown
         if (deadTx != null) {
index d7d1feef652e7fba79ea04b858902b140606889a..975ea6dbcf73f130a63117641ae7d82c9270ec39 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.dom.broker.impl.jmx;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
 import org.opendaylight.yangtools.util.DurationStatisticsTracker;
 
@@ -27,8 +26,8 @@ public class CommitStatsMXBeanImpl extends AbstractMXBean implements CommitStats
      * @param commitStatsTracker the DurationStatsTracker used to obtain the stats.
      * @param mbeantype mBeanType Used as the <code>type</code> property in the bean's ObjectName.
      */
-    public CommitStatsMXBeanImpl(@Nonnull DurationStatisticsTracker commitStatsTracker,
-            @Nonnull String mbeantype) {
+    public CommitStatsMXBeanImpl(@NonNull DurationStatisticsTracker commitStatsTracker,
+            @NonNull String mbeantype) {
         super("CommitStats", mbeantype, null);
         this.commitStatsTracker = commitStatsTracker;
     }
index 8839b96a2c106a24ce7f82dfb81f0331864b433d..86919927fecfaec65ef834b2550edbaeb9e550cc 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.md.sal.dom.broker.impl.legacy.sharded.adapter;
 
 import static com.google.common.base.Preconditions.checkNotNull;
@@ -13,7 +12,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
 import java.util.Collections;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
@@ -77,7 +75,6 @@ public class LegacyShardedDOMDataBrokerAdapter implements DOMDataBroker {
                                                                   listener);
     }
 
-    @Nonnull
     @Override
     public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
         return Collections.emptyMap();
index 5ee9c43f319e1f6dc06a6de39e7835f59a90e662..fd8ed94da2501e3827147890f61ad107a7c222e4 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.md.sal.dom.broker.impl.legacy.sharded.adapter;
 
-import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
@@ -24,7 +23,6 @@ import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.Map;
 import java.util.Queue;
-import javax.annotation.Nonnull;
 import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -69,9 +67,9 @@ class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadW
     ShardedDOMDataBrokerDelegatingReadWriteTransaction(final Object readWriteTxId, final SchemaContext ctx,
                                                               final DOMDataReadOnlyTransaction readTxDelegate,
                                                               final DOMDataWriteTransaction writeTxDelegate) {
-        this.readTxDelegate = checkNotNull(readTxDelegate);
-        this.writeTxDelegate = checkNotNull(writeTxDelegate);
-        this.txIdentifier = checkNotNull(readWriteTxId);
+        this.readTxDelegate = requireNonNull(readTxDelegate);
+        this.writeTxDelegate = requireNonNull(writeTxDelegate);
+        this.txIdentifier = requireNonNull(readWriteTxId);
         this.initialReadMap = Maps.newEnumMap(LogicalDatastoreType.class);
 
         final InMemoryDataTreeFactory treeFactory = new InMemoryDataTreeFactory();
@@ -120,7 +118,7 @@ class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadW
         final Queue<Modification> currentHistory = Lists.newLinkedList(modificationHistoryMap.get(store));
         Futures.addCallback(initialReadMap.get(store), new FutureCallback<Optional<NormalizedNode<?, ?>>>() {
             @Override
-            public void onSuccess(@Nonnull final Optional<NormalizedNode<?, ?>> result) {
+            public void onSuccess(final Optional<NormalizedNode<?, ?>> result) {
                 final DataTreeModification mod = snapshotMap.get(store).newModification();
                 if (result.isPresent()) {
                     mod.write(path, result.get());
@@ -219,8 +217,8 @@ class ShardedDOMDataBrokerDelegatingReadWriteTransaction implements DOMDataReadW
 
         Modification(final Operation operation, final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
             this.data = data;
-            this.path = checkNotNull(path);
-            this.operation = checkNotNull(operation);
+            this.path = requireNonNull(path);
+            this.operation = requireNonNull(operation);
         }
 
         Operation getOperation() {
index 51f0c04826eb5778bdb9119fc47de0733319889a..57dbf83f8c02a8c6fd26d0f9088377b618324c99 100644 (file)
@@ -26,7 +26,6 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -434,7 +433,7 @@ public class DOMDataTreeListenerTest {
         }
 
         @Override
-        public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+        public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
             receivedChanges.add(changes);
             latch.countDown();
         }
index 36c5f8f4a729bc1a64fbf7d3166bc958e116cdf5..c0f0e0234bb4bf8760582029fb33b17b62d405a1 100644 (file)
@@ -22,7 +22,7 @@ import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.dom.api.DOMEvent;
@@ -160,7 +160,7 @@ public class DOMNotificationRouterTest {
             receivedNotification.set(notification);
         }
 
-        void verifyReceived(final SchemaPath path, final ContainerNode body, @Nullable final Date eventTime)
+        void verifyReceived(final SchemaPath path, final ContainerNode body, final @Nullable Date eventTime)
                 throws InterruptedException, ExecutionException, TimeoutException {
             final DOMNotification actual = receivedNotification.get(5, TimeUnit.SECONDS);
             assertEquals(path, actual.getType());
@@ -191,7 +191,7 @@ public class DOMNotificationRouterTest {
             receivedNotification.set(notification);
         }
 
-        void verifyReceived(final SchemaPath path, final ContainerNode body, @Nullable final Instant eventTime)
+        void verifyReceived(final SchemaPath path, final ContainerNode body, final @Nullable Instant eventTime)
                 throws InterruptedException, ExecutionException, TimeoutException {
             final org.opendaylight.mdsal.dom.api.DOMNotification actual =
                     receivedNotification.get(5, TimeUnit.SECONDS);
index cfad179867e8b0399b691d788666c5b1e1e4e7a1..ab92b00150e2ceb15cd8a4fa0735bad54e1e561f 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.controller.sal.core.compat;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.collect.ImmutableClassToInstanceMap;
@@ -24,7 +23,7 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Supplier;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.MappingCheckedFuture;
 import org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.DataStoreUnavailableException;
@@ -221,20 +220,20 @@ public class LegacyDOMDataBrokerAdapter extends ForwardingObject implements DOMD
         private final DOMDataTreeWriteTransaction writeDelegate;
         private final Object identifier;
 
-        DOMDataTransactionAdapter(@Nonnull final DOMDataTreeReadTransaction readDelegate) {
-            this.readDelegate = Preconditions.checkNotNull(readDelegate);
+        DOMDataTransactionAdapter(final @NonNull DOMDataTreeReadTransaction readDelegate) {
+            this.readDelegate = requireNonNull(readDelegate);
             this.identifier = readDelegate.getIdentifier();
             this.writeDelegate = null;
         }
 
-        DOMDataTransactionAdapter(@Nonnull final DOMDataTreeWriteTransaction writeDelegate) {
-            this.writeDelegate = Preconditions.checkNotNull(writeDelegate);
+        DOMDataTransactionAdapter(final @NonNull DOMDataTreeWriteTransaction writeDelegate) {
+            this.writeDelegate = requireNonNull(writeDelegate);
             this.identifier = writeDelegate.getIdentifier();
             this.readDelegate = null;
         }
 
-        DOMDataTransactionAdapter(@Nonnull final DOMDataTreeReadWriteTransaction rwDelegate) {
-            this.readDelegate = Preconditions.checkNotNull(rwDelegate);
+        DOMDataTransactionAdapter(final @NonNull DOMDataTreeReadWriteTransaction rwDelegate) {
+            this.readDelegate = requireNonNull(rwDelegate);
             this.writeDelegate = rwDelegate;
             this.identifier = readDelegate.getIdentifier();
         }
index d25df4982a76a45bb80bda904d659c2ea28e7747..925a356a09f0f6bf1a046d20c39b48b8fdf2c7c3 100644 (file)
@@ -7,15 +7,16 @@
  */
 package org.opendaylight.controller.md.sal.dom.spi;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Objects;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.common.RpcError;
@@ -55,21 +56,21 @@ public final class DefaultDOMRpcResult implements DOMRpcResult, Immutable, Seria
     }
 
     public DefaultDOMRpcResult(final NormalizedNode<?, ?> result) {
-        this(result, Collections.<RpcError>emptyList());
+        this(result, Collections.emptyList());
     }
 
     public DefaultDOMRpcResult(final NormalizedNode<?, ?> result,
-            final @Nonnull Collection<? extends RpcError> errors) {
+            final @NonNull Collection<? extends RpcError> errors) {
         this.result = result;
-        this.errors = Preconditions.checkNotNull(errors);
+        this.errors = requireNonNull(errors);
     }
 
-    public DefaultDOMRpcResult(final @Nonnull Collection<RpcError> errors) {
+    public DefaultDOMRpcResult(final @NonNull Collection<RpcError> errors) {
         this(null, errors);
     }
 
     @Override
-    public @Nonnull Collection<? extends RpcError> getErrors() {
+    public Collection<? extends RpcError> getErrors() {
         return errors;
     }
 
index 15a5836a176152819250ffacde02b8fe118e7e86..89b8311dd79fb78ed9e3b0f0e1f1b6ff431f9c55 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import java.util.Map;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension;
@@ -24,7 +24,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
  */
 public abstract class ForwardingDOMDataBroker extends ForwardingObject implements DOMDataBroker {
     @Override
-    protected abstract @Nonnull DOMDataBroker delegate();
+    protected abstract @NonNull DOMDataBroker delegate();
 
     @Override
     public DOMDataReadOnlyTransaction newReadOnlyTransaction() {
index 474209981253b28dbee2ec32e6561abe746d5da2..8174ab36b256d002efbdeee98579b2152dec8416 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 import com.google.common.base.Optional;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public abstract class ForwardingDOMDataReadOnlyTransaction extends ForwardingObject
         implements DOMDataReadOnlyTransaction {
     @Override
-    protected abstract @Nonnull DOMDataReadOnlyTransaction delegate();
+    protected abstract @NonNull DOMDataReadOnlyTransaction delegate();
 
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
index 671e0f88767f95dda024a642b35030c5e87736d7..69e7cc2cd204cc60d03743806f0a6d53dd22183d 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.base.Optional;
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
@@ -26,7 +26,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public abstract class ForwardingDOMDataReadWriteTransaction extends ForwardingObject
         implements DOMDataReadWriteTransaction {
     @Override
-    protected abstract @Nonnull DOMDataReadWriteTransaction delegate();
+    protected abstract @NonNull DOMDataReadWriteTransaction delegate();
 
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
index 4ef889fa442ca68079d08302b7afbc8af75c3f11..b260937a720d4b0332ba77f7f156709bed45f93d 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.FluentFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.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;
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 public abstract class ForwardingDOMDataWriteTransaction extends ForwardingObject implements DOMDataWriteTransaction {
     @Override
-    protected abstract @Nonnull DOMDataWriteTransaction delegate();
+    protected abstract @NonNull DOMDataWriteTransaction delegate();
 
     @Override
     public Object getIdentifier() {
index f7a21aaf7198c82cb3bfa9627aeb10aca07eb3ba..a0b2075e5b7affe8dff1738f8959750bb3ad2921 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.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;
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 public abstract class ForwardingDOMRpcImplementation extends ForwardingObject implements DOMRpcImplementation {
     @Override
-    protected abstract @Nonnull DOMRpcImplementation delegate();
+    protected abstract @NonNull DOMRpcImplementation delegate();
 
     @Override
     public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier type,
index 3e8b5a6f1da21ad26d547ae221350411aff88bd9..8c1ac5359683a171527c21a0d34a9027be56f2f3 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistration;
@@ -21,7 +21,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
  */
 public abstract class ForwardingDOMRpcProviderService extends ForwardingObject implements DOMRpcProviderService {
     @Override
-    protected abstract @Nonnull DOMRpcProviderService delegate();
+    protected abstract @NonNull DOMRpcProviderService delegate();
 
     @Override
     public <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(
index e322b01352e64c06811f8add43db603104e699cd..d5e04e2bf08be7491e719a1446423513f745e783 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import java.util.Collection;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -20,7 +20,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  */
 public abstract class ForwardingDOMRpcResult extends ForwardingObject implements DOMRpcResult {
     @Override
-    protected abstract @Nonnull DOMRpcResult delegate();
+    protected abstract @NonNull DOMRpcResult delegate();
 
     @Override
     public Collection<? extends RpcError> getErrors() {
index a9e87d05ca73654009bf40fd8c3ed826e106ecca..887ae8a78ee59fd04c990123531ed3a70659791f 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
 import com.google.common.util.concurrent.CheckedFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
  */
 public abstract class ForwardingDOMRpcService extends ForwardingObject implements DOMRpcService {
     @Override
-    protected abstract @Nonnull DOMRpcService delegate();
+    protected abstract @NonNull DOMRpcService delegate();
 
     @Override
     public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final SchemaPath type,
index e709e6713a57a849eb98dbd648ae39f07755fc7c..891079a1594fe1461329b5e57f74e2a25cd51d48 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.spi;
 
 import com.google.common.collect.ForwardingObject;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
@@ -20,7 +20,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
  */
 public abstract class ForwardingDOMTransactionChain extends ForwardingObject implements DOMTransactionChain {
     @Override
-    protected abstract @Nonnull DOMTransactionChain delegate();
+    protected abstract @NonNull DOMTransactionChain delegate();
 
     @Override
     public void close() {
index 4131efc65bb5f51f3880b5f96ae409c93b8f45a3..20166a46ad97f1fff356a62844833c6b3ddc0607 100644 (file)
@@ -7,12 +7,13 @@
  */
 package org.opendaylight.controller.sal.core.spi.data;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import 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;
 
 /**
  * Abstract DOM Store Transaction.
@@ -29,14 +30,14 @@ import javax.annotation.Nullable;
 @Beta
 public abstract class AbstractDOMStoreTransaction<T> implements DOMStoreTransaction {
     private final Throwable debugContext;
-    private final T identifier;
+    private final @NonNull T identifier;
 
-    protected AbstractDOMStoreTransaction(@Nonnull final T identifier) {
+    protected AbstractDOMStoreTransaction(final @NonNull T identifier) {
         this(identifier, false);
     }
 
-    protected AbstractDOMStoreTransaction(@Nonnull final T identifier, final boolean debug) {
-        this.identifier = Preconditions.checkNotNull(identifier, "Identifier must not be null.");
+    protected AbstractDOMStoreTransaction(final @NonNull T identifier, final boolean debug) {
+        this.identifier = requireNonNull(identifier, "Identifier must not be null.");
         this.debugContext = debug ? new Throwable().fillInStackTrace() : null;
     }
 
@@ -48,11 +49,9 @@ public abstract class AbstractDOMStoreTransaction<T> implements DOMStoreTransact
     /**
      * Return the context in which this transaction was allocated.
      *
-     * @return The context in which this transaction was allocated, or null
-     *         if the context was not recorded.
+     * @return The context in which this transaction was allocated, or null if the context was not recorded.
      */
-    @Nullable
-    public final Throwable getDebugContext() {
+    public final @Nullable Throwable getDebugContext() {
         return debugContext;
     }
 
@@ -68,7 +67,7 @@ public abstract class AbstractDOMStoreTransaction<T> implements DOMStoreTransact
      *            ToStringHelper instance
      * @return ToStringHelper instance which was passed in
      */
-    protected ToStringHelper addToStringAttributes(@Nonnull final ToStringHelper toStringHelper) {
+    protected ToStringHelper addToStringAttributes(final @NonNull ToStringHelper toStringHelper) {
         return toStringHelper.add("id", identifier);
     }
 }
index 670cbe8d67da38a09a7db6f4d07a789f26996022..0ee2d79cdfebfccb41319012d0a0bc1303e2bd71 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.sal.core.spi.data;
 
 import java.util.Collection;
 import java.util.List;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
 import org.opendaylight.mdsal.dom.spi.AbstractRegistrationTree;
@@ -39,8 +39,8 @@ public abstract class AbstractDOMStoreTreeChangePublisher
      * @param path Path of changed candidate node. Guaranteed to match the path specified by the registration
      * @param node Candidate node
      */
-    protected abstract void notifyListeners(@Nonnull Collection<AbstractDOMDataTreeChangeListenerRegistration<?>>
-            registrations, @Nonnull YangInstanceIdentifier path, @Nonnull DataTreeCandidateNode node);
+    protected abstract void notifyListeners(@NonNull Collection<AbstractDOMDataTreeChangeListenerRegistration<?>>
+            registrations, @NonNull YangInstanceIdentifier path, @NonNull DataTreeCandidateNode node);
 
     /**
      * Callback notifying the subclass that the specified registration is being closed and it's user no longer
@@ -51,14 +51,14 @@ public abstract class AbstractDOMStoreTreeChangePublisher
      *
      * @param registration Registration which is being closed
      */
-    protected abstract void registrationRemoved(@Nonnull AbstractDOMDataTreeChangeListenerRegistration<?> registration);
+    protected abstract void registrationRemoved(@NonNull AbstractDOMDataTreeChangeListenerRegistration<?> registration);
 
     /**
      * Process a candidate tree with respect to registered listeners.
      *
      * @param candidate candidate three which needs to be processed
      */
-    protected final void processCandidateTree(@Nonnull final DataTreeCandidate candidate) {
+    protected final void processCandidateTree(final @NonNull DataTreeCandidate candidate) {
         final DataTreeCandidateNode node = candidate.getRootNode();
         if (node.getModificationType() == ModificationType.UNMODIFIED) {
             LOG.debug("Skipping unmodified candidate {}", candidate);
index 78bf7fbfd183bfa627ed7a96a2021edd23e7141c..6665bd11f0e5dff580c09d8e66bd1bc94e5fdd81 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.sal.core.spi.data;
 
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -55,6 +55,6 @@ public interface DOMStoreTreeChangePublisher {
      *         your listener using {@link ListenerRegistration#close()} to stop
      *         delivery of change events.
      */
-    @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerTreeChangeListener(
-            @Nonnull YangInstanceIdentifier treeId, @Nonnull L listener);
+    <L extends DOMDataTreeChangeListener> @NonNull ListenerRegistration<L> registerTreeChangeListener(
+            @NonNull YangInstanceIdentifier treeId, @NonNull L listener);
 }
index b5afe6a80b0471f0cb9851d3743a921b791a335a..01f4008d341ceb9677917c3ddf0f00a8814273a4 100644 (file)
@@ -15,7 +15,7 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Throwables;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
index 44961070a57b0461e2ecaac764d3325f1c212fa6..4a6019e1fd37f0d5f4e03a31ac46d527de1c9247 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.controller.sal.core.spi.data.statistics;
 
 import java.util.concurrent.ExecutorService;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.util.concurrent.QueuedNotificationManager;
 
 /**
@@ -24,19 +24,19 @@ public interface DOMStoreStatsTracker {
      *
      * @param dclExecutor the executor
      */
-    void setDataChangeListenerExecutor(@Nonnull ExecutorService dclExecutor);
+    void setDataChangeListenerExecutor(@NonNull ExecutorService dclExecutor);
 
     /**
      * Sets the executor used internally by the data store.
      *
      * @param dsExecutor the executor
      */
-    void setDataStoreExecutor(@Nonnull ExecutorService dsExecutor);
+    void setDataStoreExecutor(@NonNull ExecutorService dsExecutor);
 
     /**
      * Sets the QueuedNotificationManager use for DataChangeListener notifications.
      *
      * @param manager the manager
      */
-    void setNotificationManager(@Nonnull QueuedNotificationManager<?, ?> manager);
+    void setNotificationManager(@NonNull QueuedNotificationManager<?, ?> manager);
 }
index 7d98e0d39217e67f641ef11438f402ca9c977cbc..6571c60425ad3f1ccdbb52782dda3c7bef9c3c93 100644 (file)
@@ -8,7 +8,7 @@
 package org.opendaylight.controller.md.sal.dom.store.impl;
 
 import java.util.concurrent.ExecutorService;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
 import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
@@ -26,8 +26,7 @@ public final class InMemoryDOMDataStoreFactory {
     private InMemoryDOMDataStoreFactory() {
     }
 
-    public static InMemoryDOMDataStore create(final String name,
-            @Nullable final DOMSchemaService schemaService) {
+    public static InMemoryDOMDataStore create(final String name, final @Nullable DOMSchemaService schemaService) {
         return create(name, schemaService, null);
     }
 
@@ -40,9 +39,8 @@ public final class InMemoryDOMDataStoreFactory {
      *                   default property values are used.
      * @return an InMemoryDOMDataStore instance
      */
-    public static InMemoryDOMDataStore create(final String name,
-            @Nullable final DOMSchemaService schemaService,
-            @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
+    public static InMemoryDOMDataStore create(final String name, final @Nullable DOMSchemaService schemaService,
+            final @Nullable InMemoryDOMDataStoreConfigProperties properties) {
         return create(name, LogicalDatastoreType.OPERATIONAL, schemaService, false, properties);
     }
 
@@ -58,8 +56,8 @@ public final class InMemoryDOMDataStoreFactory {
      * @return an InMemoryDOMDataStore instance
      */
     public static InMemoryDOMDataStore create(final String name, final LogicalDatastoreType type,
-            @Nullable final DOMSchemaService schemaService, final boolean debugTransactions,
-            @Nullable final InMemoryDOMDataStoreConfigProperties properties) {
+            final @Nullable DOMSchemaService schemaService, final boolean debugTransactions,
+            final @Nullable InMemoryDOMDataStoreConfigProperties properties) {
 
         InMemoryDOMDataStoreConfigProperties actualProperties = properties;
         if (actualProperties == null) {
index 77f1b0e967e8ef8fdb5556d8fa5e05035e06384a..e9b559452ac5085c7569be03015b890a62b6b550 100644 (file)
@@ -11,7 +11,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Optional;
 import java.util.concurrent.ExecutorService;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.dom.spi.AbstractDOMDataTreeChangeListenerRegistration;
 import org.opendaylight.controller.sal.core.spi.data.AbstractDOMStoreTreeChangePublisher;
@@ -90,7 +90,7 @@ final class InMemoryDOMStoreTreeChangePublisher extends AbstractDOMStoreTreeChan
         return reg;
     }
 
-    synchronized void publishChange(@Nonnull final DataTreeCandidate candidate) {
+    synchronized void publishChange(final @NonNull DataTreeCandidate candidate) {
         // Runs synchronized with registrationRemoved()
         processCandidateTree(candidate);
     }
index eb9486da308b03ba0b2ea0ee0c467ba6e318d0d0..d5e46a9a84f8b800af5c979f06def05ec08d3d34 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.controller.remote.rpc;
 
+import static java.util.Objects.requireNonNull;
+
 import akka.dispatch.OnComplete;
-import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AbstractFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
 import org.opendaylight.mdsal.dom.api.DOMRpcException;
 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
@@ -32,7 +32,7 @@ final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult> {
     private final QName rpcName;
 
     private RemoteDOMRpcFuture(final QName rpcName) {
-        this.rpcName = Preconditions.checkNotNull(rpcName, "rpcName");
+        this.rpcName = requireNonNull(rpcName, "rpcName");
     }
 
     public static RemoteDOMRpcFuture create(final QName rpcName) {
@@ -58,7 +58,7 @@ final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult> {
     }
 
     @Override
-    public DOMRpcResult get(final long timeout, @Nonnull final TimeUnit unit)
+    public DOMRpcResult get(final long timeout, final TimeUnit unit)
             throws InterruptedException, ExecutionException, TimeoutException {
         try {
             return super.get(timeout, unit);
index 434f480770352de76cbef5cdf2d1c7a306c685d1..20f32cb0da4a4a26a625c1ae901d90ea34016ca3 100644 (file)
@@ -7,10 +7,11 @@
  */
 package org.opendaylight.controller.remote.rpc;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
+
 import akka.actor.ActorRef;
-import com.google.common.base.Preconditions;
 import java.util.Collection;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
@@ -31,20 +32,20 @@ final class RpcListener implements DOMRpcAvailabilityListener {
     private final ActorRef rpcRegistry;
 
     RpcListener(final ActorRef rpcRegistry) {
-        this.rpcRegistry = Preconditions.checkNotNull(rpcRegistry);
+        this.rpcRegistry = requireNonNull(rpcRegistry);
     }
 
     @Override
-    public void onRpcAvailable(@Nonnull final Collection<DOMRpcIdentifier> rpcs) {
-        Preconditions.checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
+    public void onRpcAvailable(final Collection<DOMRpcIdentifier> rpcs) {
+        checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
         LOG.debug("Adding registration for [{}]", rpcs);
 
         rpcRegistry.tell(new AddOrUpdateRoutes(rpcs), ActorRef.noSender());
     }
 
     @Override
-    public void onRpcUnavailable(@Nonnull final Collection<DOMRpcIdentifier> rpcs) {
-        Preconditions.checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
+    public void onRpcUnavailable(final Collection<DOMRpcIdentifier> rpcs) {
+        checkArgument(rpcs != null, "Input Collection of DOMRpcIdentifier can not be null.");
 
         LOG.debug("Removing registration for [{}]", rpcs);
         rpcRegistry.tell(new RemoveRoutes(rpcs), ActorRef.noSender());
index ec17297df2175ba8f5406de28ce16bd22abbd52a..dca81dc0b7bb29a069d514dca28f0650923011fb 100644 (file)
@@ -7,16 +7,17 @@
  */
 package org.opendaylight.controller.remote.rpc.messages;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Serializable;
-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.datastore.node.utils.stream.SerializationUtils;
 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -31,22 +32,20 @@ public final class ExecuteRpc implements Serializable {
     private final NormalizedNode<?, ?> inputNormalizedNode;
     private final QName rpc;
 
-    private ExecuteRpc(@Nullable final NormalizedNode<?, ?> inputNormalizedNode, @Nonnull final QName rpc) {
-        this.rpc = Preconditions.checkNotNull(rpc, "rpc Qname should not be null");
+    private ExecuteRpc(final @Nullable NormalizedNode<?, ?> inputNormalizedNode, final @NonNull QName rpc) {
+        this.rpc = requireNonNull(rpc, "rpc Qname should not be null");
         this.inputNormalizedNode = inputNormalizedNode;
     }
 
-    public static ExecuteRpc from(@Nonnull final DOMRpcIdentifier rpc, @Nullable final NormalizedNode<?, ?> input) {
+    public static ExecuteRpc from(final @NonNull DOMRpcIdentifier rpc, final @Nullable NormalizedNode<?, ?> input) {
         return new ExecuteRpc(input, rpc.getType().getLastComponent());
     }
 
-    @Nullable
-    public NormalizedNode<?, ?> getInputNormalizedNode() {
+    public @Nullable NormalizedNode<?, ?> getInputNormalizedNode() {
         return inputNormalizedNode;
     }
 
-    @Nonnull
-    public QName getRpc() {
+    public @NonNull QName getRpc() {
         return rpc;
     }
 
index 421e13ecb589ec3ced6108a0121a33e93c53ebf5..02d0f1f185116ce30ce0d46754ff26aefe4dd86f 100644 (file)
@@ -12,7 +12,7 @@ import java.io.Externalizable;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Serializable;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -24,12 +24,11 @@ public class RpcResponse implements Serializable {
             + "aren't serialized. FindBugs does not recognize this.")
     private final NormalizedNode<?, ?> resultNormalizedNode;
 
-    public RpcResponse(@Nullable final NormalizedNode<?, ?> inputNormalizedNode) {
+    public RpcResponse(final @Nullable NormalizedNode<?, ?> inputNormalizedNode) {
         resultNormalizedNode = inputNormalizedNode;
     }
 
-    @Nullable
-    public NormalizedNode<?, ?> getResultNormalizedNode() {
+    public @Nullable NormalizedNode<?, ?> getResultNormalizedNode() {
         return resultNormalizedNode;
     }
 
index faa51b90ade84b33c887491747ac3de88c331cf3..a97e253d01842336f1ee47456307d541c1f222bd 100644 (file)
@@ -9,12 +9,12 @@ package org.opendaylight.controller.remote.rpc.registry.gossip;
 
 import akka.actor.ActorRef;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 
 public interface Bucket<T extends BucketData<T>> {
     long getVersion();
 
-    @Nonnull T getData();
+    @NonNull T getData();
 
     default Optional<ActorRef> getWatchActor() {
         return getData().getWatchActor();
index daf945289c42b65b6adc1d0c8d31529749a378b5..535d5c7cd68d58928c14e439eb6ca889f8aa1c22 100644 (file)
@@ -7,8 +7,9 @@
  */
 package org.opendaylight.controller.remote.rpc.registry.gossip;
 
-import com.google.common.base.Preconditions;
-import com.google.common.base.Verify;
+import static com.google.common.base.Verify.verifyNotNull;
+import static java.util.Objects.requireNonNull;
+
 import java.io.Serializable;
 
 final class BucketImpl<T extends BucketData<T>> implements Bucket<T>, Serializable {
@@ -21,7 +22,7 @@ final class BucketImpl<T extends BucketData<T>> implements Bucket<T>, Serializab
 
     BucketImpl(final long version, final T data) {
         this.version = version;
-        this.data = Preconditions.checkNotNull(data);
+        this.data = requireNonNull(data);
     }
 
     @Override
@@ -40,7 +41,7 @@ final class BucketImpl<T extends BucketData<T>> implements Bucket<T>, Serializab
     }
 
     private Object readResolve() {
-        Verify.verifyNotNull(data);
+        verifyNotNull(data);
         return this;
     }
 }
index a10e22f87152f3c438f0d07d49db575b4b781cb1..8d9eb77ddc812f6a5538a2dbd7fc99cb96b7dbd7 100644 (file)
@@ -5,10 +5,8 @@
  * 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.clustering.it.provider;
 
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
@@ -28,7 +26,7 @@ public class CarDataTreeChangeListener implements DataTreeChangeListener<Cars> {
     private static final Logger LOG = LoggerFactory.getLogger(CarDataTreeChangeListener.class);
 
     @java.lang.Override
-    public void onDataTreeChanged(@Nonnull final java.util.Collection<DataTreeModification<Cars>> changes) {
+    public void onDataTreeChanged(final java.util.Collection<DataTreeModification<Cars>> changes) {
         if (LOG.isTraceEnabled()) {
             for (DataTreeModification<Cars> change : changes) {
                 ouputChanges(change);
index 4ff725f3ddeb184371d73ce0780491d108aaf7a2..458e2ed818944515c042b29ff110920ca8c11d54 100644 (file)
@@ -5,13 +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.clustering.it.provider.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 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;
@@ -56,10 +53,9 @@ public final class GetConstantService implements DOMRpcImplementation {
         return rpcProviderService.registerRpcImplementation(new GetConstantService(constant), id);
     }
 
-    @Nonnull
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
-                                                                  @Nullable final NormalizedNode<?, ?> input) {
+    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
+                                                                  final NormalizedNode<?, ?> input) {
         LOG.debug("get-constant invoked, current value: {}", constant);
 
         final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
index 2b80f84a0daf6812874662e9f1e35be3c3b830ec..574952e70e6bf22b9bac74639cd1b5903c0234ab 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.clustering.it.provider.impl;
 
 import com.google.common.base.Preconditions;
@@ -18,7 +17,6 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeListener;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeListeningException;
@@ -38,8 +36,8 @@ public class IdIntsDOMDataTreeLIstener implements DOMDataTreeListener {
     private ScheduledExecutorService executorService;
 
     @Override
-    public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes,
-                                  @Nonnull final Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees) {
+    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes,
+                                  final Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees) {
 
         // There should only be one candidate reported
         Preconditions.checkState(changes.size() == 1);
@@ -69,7 +67,7 @@ public class IdIntsDOMDataTreeLIstener implements DOMDataTreeListener {
     }
 
     @Override
-    public void onDataTreeFailed(@Nonnull Collection<DOMDataTreeListeningException> causes) {
+    public void onDataTreeFailed(Collection<DOMDataTreeListeningException> causes) {
 
     }
 
index 60d624442b1f9d4b4bd7f303a75b944fa958df17..2727f529b255c102f2f46557dfa6f55d83245858 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.clustering.it.provider.impl;
 
 import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ITEM;
@@ -22,7 +21,6 @@ import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
-import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.dom.api.ClusteredDOMDataTreeChangeListener;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -44,7 +42,7 @@ public class IdIntsListener implements ClusteredDOMDataTreeChangeListener {
     private ScheduledFuture<?> scheduledFuture;
 
     @Override
-    public void onDataTreeChanged(@Nonnull final Collection<DataTreeCandidate> changes) {
+    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
 
         // There should only be one candidate reported
         Preconditions.checkState(changes.size() == 1);
index 163d46ab9e6cfae8bd59571534017bc105cfe016..be35234ce0e7552c343b10fb74191320483acdd8 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.clustering.it.provider.impl;
 
 import static org.opendaylight.controller.clustering.it.provider.impl.AbstractTransactionHandler.ID;
@@ -23,7 +22,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.CompletionStage;
 import java.util.stream.Collectors;
-import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.access.concepts.MemberName;
 import org.opendaylight.controller.cluster.sharding.DistributedShardFactory;
 import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.DistributedShardRegistration;
@@ -97,7 +95,7 @@ public class PrefixShardHandler {
                 final ListenableFuture<?> ensureFuture = ensureListExists();
                 Futures.addCallback(ensureFuture, new FutureCallback<Object>() {
                     @Override
-                    public void onSuccess(@Nullable final Object result) {
+                    public void onSuccess(final Object result) {
                         LOG.debug("Initial list write successful.");
                         future.set(RpcResultBuilder.success(new CreatePrefixShardOutputBuilder().build()).build());
                     }
@@ -193,7 +191,7 @@ public class PrefixShardHandler {
         final ListenableFuture<?> future = tx.commit();
         Futures.addCallback(future, new FutureCallback<Object>() {
             @Override
-            public void onSuccess(@Nullable final Object result) {
+            public void onSuccess(final Object result) {
                 try {
                     LOG.debug("Closing producer for initial list.");
                     producer.close();
index ec0afe328efa1e2b8970bc0beab8d0317da51ec0..6f90c8c947eaa81dca524c62d93018a93e10eb81 100644 (file)
@@ -5,13 +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.clustering.it.provider.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 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;
@@ -64,10 +61,9 @@ public final class RoutedGetConstantService implements DOMRpcImplementation {
         return rpcProviderService.registerRpcImplementation(new RoutedGetConstantService(constant), id);
     }
 
-    @Nonnull
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final DOMRpcIdentifier rpc,
-                                                                  @Nullable final NormalizedNode<?, ?> input) {
+    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
+                                                                  final NormalizedNode<?, ?> input) {
         LOG.debug("get-contexted-constant invoked, current value: {}", constant);
 
         final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()
index 8f3dc2caad31c023081e6fda09c9ccad7ec3d7a2..50060d36c4485d83e3e279c91885fc907e54788c 100644 (file)
@@ -5,14 +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.clustering.it.provider.impl;
 
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 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;
@@ -73,10 +70,9 @@ public final class SingletonGetConstantService implements DOMRpcImplementation,
                 .registerClusterSingletonService(new SingletonGetConstantService(rpcProviderService, constant));
     }
 
-    @Nonnull
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull DOMRpcIdentifier rpc,
-            @Nullable NormalizedNode<?, ?> input) {
+    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(DOMRpcIdentifier rpc,
+            NormalizedNode<?, ?> input) {
         LOG.debug("get-singleton-constant invoked, current value: {}", constant);
 
         final LeafNode<Object> value = ImmutableLeafNodeBuilder.create()