Avoid use of Objects.hash when there's only 1 params
- directly call #hashCode() when hashed Object seems non-null
- replace with Objects.hashCode(Object) when Nullable
- replace with Long.hashCode(long), etc. when primitive
Change-Id: I08c24ebbe94cf4162d1491209a14baf953163e41
diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/NextHopGroupKey.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/NextHopGroupKey.java
index 82a45a0..cd4c4e9 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/NextHopGroupKey.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/NextHopGroupKey.java
@@ -61,7 +61,7 @@
@Override
public int hashCode() {
- return Objects.hash(address);
+ return address.hashCode();
}
@Override
diff --git a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java b/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
index 974da80..24d1a8d 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/bgp/BgpRouteEntry.java
@@ -421,7 +421,7 @@
@Override
public int hashCode() {
- return Objects.hash(pathSegments);
+ return pathSegments.hashCode();
}
@Override
diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultTunnel.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultTunnel.java
index 8c6fbe8..7016143 100644
--- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultTunnel.java
+++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/DefaultTunnel.java
@@ -17,8 +17,6 @@
package org.onosproject.segmentrouting;
import java.util.List;
-import java.util.Objects;
-
import static com.google.common.base.Preconditions.checkNotNull;
/**
@@ -96,7 +94,7 @@
@Override
public int hashCode() {
- return Objects.hash(labelIds);
+ return labelIds.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
index c715d08..7dca32d 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
@@ -49,7 +49,7 @@
@Override
public int hashCode() {
- return Objects.hash(bindingHostId);
+ return bindingHostId.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
index e96e666..30631d2 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(physicalNetwork);
+ return physicalNetwork.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
index 9ec1dc6..33ddcbf 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
@@ -52,7 +52,7 @@
@Override
public int hashCode() {
- return Objects.hash(securityGroup);
+ return securityGroup.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
index a076265..651ebd8 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(segmentationId);
+ return segmentationId.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
index 4bcc332..eb93d15 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(subnetId);
+ return subnetId.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
index c4d99e4..0e7c941 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(tenantId);
+ return tenantId.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
index fbb9e48..8680d28 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
@@ -52,7 +52,7 @@
@Override
public int hashCode() {
- return Objects.hash(networkId);
+ return networkId.hashCode();
}
@Override
diff --git a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
index 3038bdf..a386348 100644
--- a/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
+++ b/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
@@ -46,7 +46,7 @@
@Override
public int hashCode() {
- return Objects.hash(portId);
+ return portId.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/cfg/ConfigProperty.java b/core/api/src/main/java/org/onosproject/cfg/ConfigProperty.java
index 36cd22b..f1b602e 100644
--- a/core/api/src/main/java/org/onosproject/cfg/ConfigProperty.java
+++ b/core/api/src/main/java/org/onosproject/cfg/ConfigProperty.java
@@ -245,7 +245,7 @@
@Override
public int hashCode() {
- return Objects.hash(name);
+ return name.hashCode();
}
/**
diff --git a/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java b/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java
index 5f3e0e1..3787daa 100644
--- a/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java
+++ b/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java
@@ -20,6 +20,7 @@
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Default implementation of a controller instance descriptor.
@@ -57,7 +58,7 @@
* @param tcpPort TCP port
*/
public DefaultControllerNode(NodeId id, IpAddress ip, int tcpPort) {
- this.id = id;
+ this.id = checkNotNull(id);
this.ip = ip;
this.tcpPort = tcpPort;
}
@@ -79,7 +80,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/cluster/NodeId.java b/core/api/src/main/java/org/onosproject/cluster/NodeId.java
index 6cfb42c..e5ab9dc 100644
--- a/core/api/src/main/java/org/onosproject/cluster/NodeId.java
+++ b/core/api/src/main/java/org/onosproject/cluster/NodeId.java
@@ -35,7 +35,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/core/DefaultApplicationId.java b/core/api/src/main/java/org/onosproject/core/DefaultApplicationId.java
index c7b5b2d..aedfb0d 100644
--- a/core/api/src/main/java/org/onosproject/core/DefaultApplicationId.java
+++ b/core/api/src/main/java/org/onosproject/core/DefaultApplicationId.java
@@ -58,7 +58,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return Short.hashCode(id);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/core/DefaultGroupId.java b/core/api/src/main/java/org/onosproject/core/DefaultGroupId.java
index 9fa8d2b..243e521 100644
--- a/core/api/src/main/java/org/onosproject/core/DefaultGroupId.java
+++ b/core/api/src/main/java/org/onosproject/core/DefaultGroupId.java
@@ -42,7 +42,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/core/Version.java b/core/api/src/main/java/org/onosproject/core/Version.java
index a537701..06e9e20 100644
--- a/core/api/src/main/java/org/onosproject/core/Version.java
+++ b/core/api/src/main/java/org/onosproject/core/Version.java
@@ -127,7 +127,7 @@
@Override
public int hashCode() {
- return Objects.hash(format);
+ return format.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/DefaultPath.java b/core/api/src/main/java/org/onosproject/net/DefaultPath.java
index a4789ca..2da2463 100644
--- a/core/api/src/main/java/org/onosproject/net/DefaultPath.java
+++ b/core/api/src/main/java/org/onosproject/net/DefaultPath.java
@@ -88,7 +88,7 @@
@Override
public int hashCode() {
- return Objects.hash(links);
+ return links.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/DeviceId.java b/core/api/src/main/java/org/onosproject/net/DeviceId.java
index 5331342..e2c1214 100644
--- a/core/api/src/main/java/org/onosproject/net/DeviceId.java
+++ b/core/api/src/main/java/org/onosproject/net/DeviceId.java
@@ -75,7 +75,7 @@
@Override
public int hashCode() {
- return Objects.hash(str);
+ return str.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java b/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java
index 3f78295..a15217c 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/BridgeName.java
@@ -52,7 +52,7 @@
@Override
public int hashCode() {
- return Objects.hash(name);
+ return name.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index bcc8bd8..4e5d39a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -516,7 +516,7 @@
@Override
public int hashCode() {
- return Objects.hash(type().ordinal());
+ return type().ordinal();
}
@Override
@@ -550,7 +550,7 @@
@Override
public int hashCode() {
- return Objects.hash(type().ordinal());
+ return type().ordinal();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
index a6e5903..4af3d16 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
@@ -114,7 +114,7 @@
@Override
public int hashCode() {
- return Objects.hash(lambda);
+ return lambda.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
index c6847d1..b72dd7b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
@@ -62,7 +62,7 @@
@Override
public int hashCode() {
- return Objects.hash(oduSignalId);
+ return oduSignalId.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java b/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java
index 546a451..97f8aed 100644
--- a/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java
+++ b/core/api/src/main/java/org/onosproject/net/group/DefaultGroup.java
@@ -186,7 +186,7 @@
*/
@Override
public int hashCode() {
- return super.hashCode() + Objects.hash(id);
+ return Objects.hash(super.hashCode(), id);
}
/*
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
index 20ccb55..444feee 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
@@ -87,7 +87,7 @@
@Override
public int hashCode() {
- return Objects.hash(bandwidth);
+ return bandwidth.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java
index 9dd813b..7811a00 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java
@@ -69,7 +69,7 @@
@Override
public int hashCode() {
- return Objects.hash(lambda);
+ return Objects.hashCode(lambda);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java
index 54eb4ea..aecef87 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java
@@ -67,7 +67,7 @@
@Override
public int hashCode() {
- return Objects.hash(latency);
+ return latency.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java
index cb1e6b2..ca4f3fd 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java
@@ -66,7 +66,7 @@
@Override
public int hashCode() {
- return Objects.hash(obstacles);
+ return obstacles.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java
index 1acf6df..4839fee 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java
@@ -91,7 +91,7 @@
@Override
public int hashCode() {
- return Objects.hash(waypoints);
+ return waypoints.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceAllocation.java b/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceAllocation.java
index 74f6e10..05cf28f 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceAllocation.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceAllocation.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(bandwidth);
+ return bandwidth.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java
index e07309c..722b870 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/link/BandwidthResourceRequest.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(bandwidth);
+ return bandwidth.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/resource/link/LambdaResourceAllocation.java b/core/api/src/main/java/org/onosproject/net/resource/link/LambdaResourceAllocation.java
index 545f025..161cf45 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/link/LambdaResourceAllocation.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/link/LambdaResourceAllocation.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(lambda);
+ return Objects.hashCode(lambda);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/resource/link/MplsLabelResourceAllocation.java b/core/api/src/main/java/org/onosproject/net/resource/link/MplsLabelResourceAllocation.java
index 1091153..cc9edc2 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/link/MplsLabelResourceAllocation.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/link/MplsLabelResourceAllocation.java
@@ -54,7 +54,7 @@
@Override
public int hashCode() {
- return Objects.hash(mplsLabel);
+ return Objects.hashCode(mplsLabel);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/topology/ClusterId.java b/core/api/src/main/java/org/onosproject/net/topology/ClusterId.java
index 676f006..1e6780f 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/ClusterId.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/ClusterId.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyEdge.java b/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyEdge.java
index dacb5fd..99d700e 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyEdge.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyEdge.java
@@ -20,6 +20,7 @@
import java.util.Objects;
import static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Implementation of the topology edge backed by a link.
@@ -40,7 +41,7 @@
public DefaultTopologyEdge(TopologyVertex src, TopologyVertex dst, Link link) {
this.src = src;
this.dst = dst;
- this.link = link;
+ this.link = checkNotNull(link);
}
@Override
@@ -60,7 +61,7 @@
@Override
public int hashCode() {
- return Objects.hash(link);
+ return link.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyVertex.java b/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyVertex.java
index 07a09cb..4782bc9 100644
--- a/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyVertex.java
+++ b/core/api/src/main/java/org/onosproject/net/topology/DefaultTopologyVertex.java
@@ -42,7 +42,7 @@
@Override
public int hashCode() {
- return Objects.hash(deviceId);
+ return deviceId.hashCode();
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java b/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java
index 0cc7b45..4be7ede 100644
--- a/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java
+++ b/core/api/src/main/java/org/onosproject/store/service/WallClockTimestamp.java
@@ -52,7 +52,7 @@
}
@Override
public int hashCode() {
- return Objects.hash(unixTimestamp);
+ return Long.hashCode(unixTimestamp);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/ui/UiView.java b/core/api/src/main/java/org/onosproject/ui/UiView.java
index 2b8b7fa2..c867115 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiView.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiView.java
@@ -138,7 +138,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id.hashCode();
}
@Override
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java b/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
index d42e22f..1420147 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentTestsMocks.java
@@ -192,14 +192,17 @@
new MplsLabelResourceAllocation(MplsLabel.valueOf(10)));
}
+ @Override
public IntentId intentId() {
return null;
}
+ @Override
public Collection<Link> links() {
return null;
}
+ @Override
public Set<ResourceRequest> resources() {
return null;
}
@@ -408,7 +411,7 @@
@Override
public int hashCode() {
- return Objects.hash(priority);
+ return priority;
}
@Override
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SystemClockTimestamp.java b/core/common/src/test/java/org/onosproject/store/trivial/SystemClockTimestamp.java
index 2ee4194..500a09c 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SystemClockTimestamp.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SystemClockTimestamp.java
@@ -51,7 +51,7 @@
}
@Override
public int hashCode() {
- return Objects.hash(nanoTimestamp);
+ return Long.hashCode(nanoTimestamp);
}
@Override
diff --git a/core/store/dist/src/main/java/org/onosproject/store/impl/LogicalTimestamp.java b/core/store/dist/src/main/java/org/onosproject/store/impl/LogicalTimestamp.java
index 9382960..dfee998 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/impl/LogicalTimestamp.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/impl/LogicalTimestamp.java
@@ -50,7 +50,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return Long.hashCode(value);
}
@Override
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionId.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionId.java
index 885361f..f6cd198 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionId.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/PartitionId.java
@@ -56,7 +56,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id;
}
@Override
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java b/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java
index 4a42a74..ad5e5d1 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/domain/DomainEdge.java
@@ -39,7 +39,7 @@
@Override
public int hashCode() {
- return 43 * super.hashCode() + Objects.hash(connectPoint);
+ return 43 * super.hashCode() + connectPoint.hashCode();
}
@Override
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java
index 90f5eab..d599486 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/tunnel/OpticalLogicId.java
@@ -63,7 +63,7 @@
@Override
public int hashCode() {
- return Objects.hash(logicId);
+ return Objects.hashCode(logicId);
}
@Override
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java
index 54a22a4..e3339a9 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/DefaultVirtualDevice.java
@@ -53,7 +53,7 @@
@Override
public int hashCode() {
- return 31 * super.hashCode() + Objects.hash(networkId);
+ return 31 * super.hashCode() + networkId.hashCode();
}
@Override
diff --git a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java
index a00f880..196c17d 100644
--- a/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java
+++ b/incubator/api/src/main/java/org/onosproject/incubator/net/virtual/TenantId.java
@@ -59,7 +59,7 @@
@Override
public int hashCode() {
- return Objects.hash(id);
+ return id.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java
index 899799f..759ec49 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbBridgeName.java
@@ -49,7 +49,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java
index 8ccf45f..02989af 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbDatapathId.java
@@ -47,7 +47,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java
index 10ba80b..bf724fa 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbIfaceId.java
@@ -47,7 +47,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java
index 48a833b..d7a5f61 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbNodeId.java
@@ -44,7 +44,7 @@
@Override
public int hashCode() {
- return Objects.hash(nodeId);
+ return nodeId.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java
index d9c7c2d..7d40e99 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortName.java
@@ -49,7 +49,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java
index bd094d0..86fc887 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortNumber.java
@@ -47,7 +47,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return Objects.hashCode(value);
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java
index e019859..fb7cdb0 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbPortType.java
@@ -49,7 +49,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java
index 80befab..490d640 100644
--- a/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java
+++ b/ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbTunnelName.java
@@ -48,7 +48,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java
index 812a034..0673b79 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdate.java
@@ -85,7 +85,7 @@
@Override
public int hashCode() {
- return Objects.hash(rows);
+ return rows.hashCode();
}
@Override
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java
index 8938bee..e161016 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/message/TableUpdates.java
@@ -67,7 +67,7 @@
@Override
public int hashCode() {
- return Objects.hash(result);
+ return result.hashCode();
}
@Override
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java
index fce3f69..a62ab0d 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbMap.java
@@ -61,7 +61,7 @@
@Override
public int hashCode() {
- return Objects.hash(map);
+ return map.hashCode();
}
@Override
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java
index fa5abe8..21f0b72 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/OvsdbSet.java
@@ -63,7 +63,7 @@
@Override
public int hashCode() {
- return Objects.hash(set);
+ return set.hashCode();
}
@Override
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java
index 463b75d..0177eea 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/notation/UUID.java
@@ -62,7 +62,7 @@
@Override
public int hashCode() {
- return Objects.hash(value);
+ return value.hashCode();
}
@Override
diff --git a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java
index 6b7c797..af1a01d 100644
--- a/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java
+++ b/ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/tableservice/AbstractOvsdbTableService.java
@@ -210,7 +210,7 @@
return null;
}
ColumnDescription columnDesc = new ColumnDescription("_uuid", "getTableUuidColumn");
- return (Column) getColumnHandler(columnDesc);
+ return getColumnHandler(columnDesc);
}
@Override
@@ -228,7 +228,7 @@
return null;
}
ColumnDescription columnDesc = new ColumnDescription("_version", "getTableVersionColumn");
- return (Column) getColumnHandler(columnDesc);
+ return getColumnHandler(columnDesc);
}
/**
@@ -260,7 +260,7 @@
@Override
public int hashCode() {
- return Objects.hash(row);
+ return row.hashCode();
}
@Override
@@ -277,7 +277,7 @@
@Override
public String toString() {
- TableSchema schema = (TableSchema) getTableSchema();
+ TableSchema schema = getTableSchema();
String tableName = schema.name();
return toStringHelper(this).add("tableName", tableName).add("row", row).toString();
}
diff --git a/utils/jdvue/src/main/java/org/onlab/jdvue/DependencyCycle.java b/utils/jdvue/src/main/java/org/onlab/jdvue/DependencyCycle.java
index 444995b..0fc761d 100644
--- a/utils/jdvue/src/main/java/org/onlab/jdvue/DependencyCycle.java
+++ b/utils/jdvue/src/main/java/org/onlab/jdvue/DependencyCycle.java
@@ -110,7 +110,7 @@
@Override
public int hashCode() {
- return Objects.hash(cycle);
+ return cycle.hashCode();
}
@Override
diff --git a/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java b/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java
index 206a34c..dfa150e 100644
--- a/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java
+++ b/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java
@@ -30,8 +30,8 @@
*/
public class DisjointPathPair<V extends Vertex, E extends Edge<V>> implements Path<V, E> {
- private Path<V, E> primary, secondary;
- boolean primaryActive = true;
+ private final Path<V, E> primary, secondary;
+ private boolean primaryActive = true;
/**
* Creates a disjoint path pair from two paths.
@@ -88,7 +88,7 @@
* @return boolean representing whether it has backup
*/
public boolean hasBackup() {
- return secondary != null && secondary.edges() != null;
+ return secondary != null;
}
@Override
@@ -103,7 +103,9 @@
@Override
public int hashCode() {
- return hasBackup() ? Objects.hash(primary) + Objects.hash(secondary) :
+ // Note: DisjointPathPair with primary and secondary swapped
+ // must result in same hashCode
+ return hasBackup() ? primary.hashCode() + secondary.hashCode() :
Objects.hash(primary);
}
diff --git a/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java.orig b/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java.orig
deleted file mode 100644
index 1cf22b6..0000000
--- a/utils/misc/src/main/java/org/onlab/graph/DisjointPathPair.java.orig
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package org.onlab.graph;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.collect.ImmutableSet.of;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-
-public class DisjointPathPair<V extends Vertex, E extends Edge<V>> implements Path<V, E> {
- public Path<V, E> path1, path2;
- boolean usingPath1 = true;
-
-<<<<<<< HEAD
- /**
- * Creates a Disjoint Path Pair from two paths.
- *
- * @param p1 first path
- * @param p2 second path
- */
-=======
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public DisjointPathPair(Path<V, E> p1, Path<V, E> p2) {
- path1 = p1;
- path2 = p2;
- }
-<<<<<<< HEAD
-
- @Override
-=======
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public V src() {
- return path1.src();
- }
-
-<<<<<<< HEAD
- @Override
- public V dst() {
- return path1.dst();
- }
-
- @Override
-=======
- public V dst() {
- return path1.dst();
- }
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public double cost() {
- if (!hasBackup()) {
- return path1.cost();
- }
- return path1.cost() + path2.cost();
- }
-<<<<<<< HEAD
-
- @Override
-=======
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public List<E> edges() {
- if (usingPath1 || !hasBackup()) {
- return path1.edges();
- } else {
- return path2.edges();
- }
- }
-<<<<<<< HEAD
-
- /**
- * Checks if this path pair contains a backup/secondary path.
- *
- * @return boolean representing whether it has backup
- */
- public boolean hasBackup() {
- return path2 != null && path2.edges() != null;
- }
-
- /**
- * Switches this disjoint path pair to using its backup path, instead of
- * using its primary.
- */
- public void useBackup() {
- usingPath1 = !usingPath1;
- }
-
- @Override
-=======
- public boolean hasBackup() {
- return path2 != null && path2.edges() != null;
- }
- public void useBackup() {
- usingPath1 = !usingPath1;
- }
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public String toString() {
- return toStringHelper(this)
- .add("src", src())
- .add("dst", dst())
- .add("cost", cost())
- .add("edges", edges())
- .toString();
- }
-<<<<<<< HEAD
-
- @Override
-=======
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public int hashCode() {
- Set<Path<V, E>> paths;
- if (!hasBackup()) {
- paths = of(path1);
- } else {
- paths = of(path1, path2);
- }
- return Objects.hash(paths);
- }
-<<<<<<< HEAD
-
- @Override
-=======
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj instanceof DisjointPathPair) {
- final DisjointPathPair other = (DisjointPathPair) obj;
- return Objects.equals(this.src(), other.src()) &&
- Objects.equals(this.dst(), other.dst()) &&
- (Objects.equals(this.path1, other.path1) &&
- Objects.equals(this.path2, other.path2)) ||
- (Objects.equals(this.path1, other.path2) &&
- Objects.equals(this.path2, other.path1));
- }
- return false;
- }
-<<<<<<< HEAD
-
- /**
- * Returns number of paths inside this path pair object.
- *
- * @return number of paths
- */
-=======
->>>>>>> Disjoint Path Pairs (Suurballe) utils
- public int size() {
- if (hasBackup()) {
- return 2;
- }
- return 1;
- }
-}
diff --git a/utils/misc/src/main/java/org/onlab/util/Frequency.java b/utils/misc/src/main/java/org/onlab/util/Frequency.java
index 5669abd..1ef7113 100644
--- a/utils/misc/src/main/java/org/onlab/util/Frequency.java
+++ b/utils/misc/src/main/java/org/onlab/util/Frequency.java
@@ -18,8 +18,6 @@
import com.google.common.base.MoreObjects;
import com.google.common.collect.ComparisonChain;
-import java.util.Objects;
-
/**
* Class representing frequency. This class is intended to be used for a value whose unit is Hz
* and its family (KHz, MHz, etc.).
@@ -157,7 +155,7 @@
@Override
public int hashCode() {
- return Objects.hash(frequency);
+ return Long.hashCode(frequency);
}
@Override
diff --git a/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java b/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java
new file mode 100644
index 0000000..ca6c56c
--- /dev/null
+++ b/utils/misc/src/test/java/org/onlab/graph/DisjointPathPairTest.java
@@ -0,0 +1,43 @@
+package org.onlab.graph;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test of DisjointPathPair.
+ */
+public class DisjointPathPairTest {
+
+ private static final TestVertex A = new TestVertex("A");
+ private static final TestVertex B = new TestVertex("B");
+ private static final TestVertex C = new TestVertex("C");
+ private static final TestVertex D = new TestVertex("D");
+
+ private static final TestEdge AB = new TestEdge(A, B, 1.0);
+ private static final TestEdge BC = new TestEdge(B, C, 1.0);
+ private static final TestEdge AD = new TestEdge(A, D, 1.0);
+ private static final TestEdge DC = new TestEdge(D, C, 1.0);
+
+ private static final Path<TestVertex, TestEdge> ABC
+ = new DefaultPath<>(ImmutableList.of(AB, BC), 1.0);
+ private static final Path<TestVertex, TestEdge> ADC
+ = new DefaultPath<>(ImmutableList.of(AD, DC), 1.0);
+
+ @Test
+ public void testSwappingPrimarySecondaryDoesntImpactHashCode() {
+ assertEquals(new DisjointPathPair<>(ABC, ADC).hashCode(),
+ new DisjointPathPair<>(ADC, ABC).hashCode());
+ }
+
+ @Test
+ public void testSwappingPrimarySecondaryDoesntImpactEquality() {
+ new EqualsTester()
+ .addEqualityGroup(new DisjointPathPair<>(ABC, ADC),
+ new DisjointPathPair<>(ADC, ABC));
+ }
+
+}
diff --git a/utils/misc/src/test/java/org/onlab/graph/TestVertex.java b/utils/misc/src/test/java/org/onlab/graph/TestVertex.java
index be92bd2..b0b92a4 100644
--- a/utils/misc/src/test/java/org/onlab/graph/TestVertex.java
+++ b/utils/misc/src/test/java/org/onlab/graph/TestVertex.java
@@ -30,7 +30,7 @@
@Override
public int hashCode() {
- return Objects.hash(name);
+ return name.hashCode();
}
@Override
diff --git a/utils/stc/src/main/java/org/onlab/stc/Step.java b/utils/stc/src/main/java/org/onlab/stc/Step.java
index 3d8ea98..e14addb 100644
--- a/utils/stc/src/main/java/org/onlab/stc/Step.java
+++ b/utils/stc/src/main/java/org/onlab/stc/Step.java
@@ -101,7 +101,7 @@
@Override
public int hashCode() {
- return Objects.hash(name);
+ return name.hashCode();
}
@Override