aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/graph/Digraph.java
diff options
context:
space:
mode:
authorGravatar dbabkin <dbabkin@google.com>2018-04-09 01:23:45 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-09 01:24:54 -0700
commitee8000dc81eab05975d4cd589263cd593dc73980 (patch)
tree11644ef183d00166494b36987fb66dff3ce2af4b /src/main/java/com/google/devtools/build/lib/graph/Digraph.java
parent825946bb036c10b0340d02638b18cec2edb2a5c2 (diff)
Remove hashCode int field from Node.
This is needless of complexity. Having counter in DiGraph can provide us with deterministic hashCode for every application run. There is no visible usage of this feature right now. More than, user of the DiGraph class should not rely on the fact the hashCode of the object will always be deterministic. Default Object.hashCode implementation returns deterministic result in cope of single JVM, and this is enough. RELNOTES:none PiperOrigin-RevId: 192093877
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/graph/Digraph.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/graph/Digraph.java7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/graph/Digraph.java b/src/main/java/com/google/devtools/build/lib/graph/Digraph.java
index 011f6baec7..8300bef095 100644
--- a/src/main/java/com/google/devtools/build/lib/graph/Digraph.java
+++ b/src/main/java/com/google/devtools/build/lib/graph/Digraph.java
@@ -79,11 +79,6 @@ public final class Digraph<T> implements Cloneable {
private final HashMap<T, Node<T>> nodes = Maps.newHashMap();
/**
- * A source of unique, deterministic hashCodes for {@link Node} instances.
- */
- private int nextHashCode = 0;
-
- /**
* Construct an empty Digraph.
*/
public Digraph() {}
@@ -377,7 +372,7 @@ public final class Digraph<T> implements Cloneable {
if (label == null) {
throw new NullPointerException();
}
- return nodes.computeIfAbsent(label, k -> new Node<>(k, nextHashCode++));
+ return nodes.computeIfAbsent(label, k -> new Node<>(k));
}
/******************************************************************