Replace some casts from BuildRule to Buildable with rule.getBuildable().
Summary:
I think that we needed these casts at one time, but now they are no
longer appropriate. Especially since more of our implementations of
`BuildRule` do not actually implement `Buildable`.
Test Plan: Sandcastle builds.
diff --git a/src/com/facebook/buck/cli/TargetsCommand.java b/src/com/facebook/buck/cli/TargetsCommand.java
index 5f95da2..ed41f98 100644
--- a/src/com/facebook/buck/cli/TargetsCommand.java
+++ b/src/com/facebook/buck/cli/TargetsCommand.java
@@ -136,7 +136,7 @@
String output = target.getKey();
if (showOutput) {
BuildRule buildRule = target.getValue();
- String outputPath = ((Buildable)buildRule).getPathToOutputFile();
+ String outputPath = buildRule.getBuildable().getPathToOutputFile();
if (outputPath != null) {
output += " " + outputPath;
}
diff --git a/src/com/facebook/buck/java/AnnotationProcessingParams.java b/src/com/facebook/buck/java/AnnotationProcessingParams.java
index 5110f85..3316c09 100644
--- a/src/com/facebook/buck/java/AnnotationProcessingParams.java
+++ b/src/com/facebook/buck/java/AnnotationProcessingParams.java
@@ -19,7 +19,6 @@
import com.facebook.buck.rules.AnnotationProcessingData;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleResolver;
-import com.facebook.buck.rules.Buildable;
import com.facebook.buck.rules.RuleKey;
import com.facebook.buck.util.BuckConstant;
import com.facebook.buck.util.HumanReadableException;
@@ -190,7 +189,7 @@
// We're using raw strings here to avoid circular dependencies.
// TODO(simons): don't use raw strings.
if ("java_binary".equals(type) || "prebuilt_jar".equals(type)) {
- String pathToOutput = ((Buildable)rule).getPathToOutputFile();
+ String pathToOutput = rule.getBuildable().getPathToOutputFile();
if (pathToOutput != null) {
searchPathElements.add(pathToOutput);
}
diff --git a/src/com/facebook/buck/rules/BuildTargetSourcePath.java b/src/com/facebook/buck/rules/BuildTargetSourcePath.java
index 0e6d197..f90dd2f 100644
--- a/src/com/facebook/buck/rules/BuildTargetSourcePath.java
+++ b/src/com/facebook/buck/rules/BuildTargetSourcePath.java
@@ -41,7 +41,7 @@
throw new HumanReadableException("Cannot resolve: %s", buildTarget);
}
- String path = ((Buildable)rule).getPathToOutputFile();
+ String path = rule.getBuildable().getPathToOutputFile();
if (path == null) {
throw new HumanReadableException("No known output for: %s", buildTarget);
}