BaseFunction: don't define equality

The fact that two functions are defined in the same location does not imply
that they are equal; they still might depend on unequal values imported
from somewhere else. In particular, the starlark semantics nowadays changes
the way labels are interpreted (due to renaming).

Fixes #8937.

Change-Id: Ice4abca38b7f208df5741cd64f15bea1b25d87cc
PiperOrigin-RevId: 259943323
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java
index 8904f9d..0d3c49a 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BaseFunction.java
@@ -26,7 +26,6 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import javax.annotation.Nullable;
 
 /**
@@ -575,23 +574,6 @@
     return builder.toString();
   }
 
-  @Override
-  public boolean equals(@Nullable Object other) {
-    if (other instanceof BaseFunction) {
-      BaseFunction that = (BaseFunction) other;
-      // In theory, the location alone unambiguously identifies a given function. However, in
-      // some test cases the location might not have a valid value, thus we also check the name.
-      return Objects.equals(this.getName(), that.getName())
-          && Objects.equals(this.location, that.location);
-    }
-    return false;
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(getName(), location);
-  }
-
   @Nullable
   public Location getLocation() {
     return location;
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeProviderApi.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeProviderApi.java
index 645f96e..5b07317 100644
--- a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeProviderApi.java
+++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeProviderApi.java
@@ -47,10 +47,4 @@
 
   @Override
   public void repr(SkylarkPrinter printer) {}
-
-  @Override
-  public boolean equals(@Nullable Object other) {
-    // Use exact object matching.
-    return this == other;
-  }
 }
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeSkylarkRuleFunctionsApi.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeSkylarkRuleFunctionsApi.java
index c30ab1e..32a5b56 100644
--- a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeSkylarkRuleFunctionsApi.java
+++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/FakeSkylarkRuleFunctionsApi.java
@@ -47,7 +47,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
-import javax.annotation.Nullable;
 
 /**
  * Fake implementation of {@link SkylarkRuleFunctionsApi}.
@@ -244,12 +243,6 @@
     public RuleDefinitionIdentifier() {
       super("RuleDefinitionIdentifier" + idCounter++);
     }
-
-    @Override
-    public boolean equals(@Nullable Object other) {
-      // Use exact object matching.
-      return this == other;
-    }
   }
 
   /**
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/repository/FakeRepositoryModule.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/repository/FakeRepositoryModule.java
index 7c1ab1c..30bb834 100644
--- a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/repository/FakeRepositoryModule.java
+++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/repository/FakeRepositoryModule.java
@@ -31,7 +31,6 @@
 import com.google.devtools.build.skydoc.rendering.proto.StardocOutputProtos.RuleInfo;
 import java.util.List;
 import java.util.stream.Collectors;
-import javax.annotation.Nullable;
 
 /**
  * Fake implementation of {@link RepositoryModuleApi}.
@@ -96,11 +95,5 @@
     public RepositoryRuleDefinitionIdentifier() {
       super("RepositoryRuleDefinitionIdentifier" + idCounter++);
     }
-
-    @Override
-    public boolean equals(@Nullable Object other) {
-      // Use exact object matching.
-      return this == other;
-    }
   }
 }