Fix Artifact's implementation of Comparable
@@ -41,8 +41,6 @@ import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization;
import com.google.devtools.build.lib.skylarkbuildapi.FileApi;
import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter;
-import com.google.devtools.build.lib.syntax.EvalUtils;
-import com.google.devtools.build.lib.syntax.EvalUtils.ComparisonException;
import com.google.devtools.build.lib.util.FileType;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -110,7 +108,7 @@ public class Artifact
implements FileType.HasFileType,
ActionInput,
FileApi,
- Comparable<Object>,
+ Comparable<Artifact>,
CommandLineItem,
SkyKey {
@@ -166,11 +164,8 @@ public class Artifact
public static final SkyFunctionName ARTIFACT = SkyFunctionName.createHermetic("ARTIFACT");
@Override
- public int compareTo(Object o) {
- if (o instanceof Artifact) {
- return EXEC_PATH_COMPARATOR.compare(this, (Artifact) o);
- }
- throw new ComparisonException("Cannot compare artifact with " + EvalUtils.getDataTypeName(o));
+ public int compareTo(Artifact o) {
+ return EXEC_PATH_COMPARATOR.compare(this, o);
}
/** An object that can expand middleman and tree artifacts. */
