aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2015-03-20 16:40:53 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-03-23 11:52:31 +0000
commit5df6cb34827ae3773a27199b290980fb241e65a5 (patch)
tree96cff532f80b99936a7a9dfe0076003471b8a387 /src/main/java/com/google/devtools/build/lib
parentb5ba24a3f3ee0e7da718bf8becac96d691ae2074 (diff)
remove ActionMetadata#getInputCount
Removing ActionMetadata#getInputCount instead of relying on all implementations of ActionMetadata keeping getInputCount and getInputs in sync. getInputCount is only used by a few tests and has no applications in the main code at the moment, so it is trivial to remove before we may come to rely on it more or its semantics get more complicated. -- MOS_MIGRATED_REVID=89130009
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java10
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java6
3 files changed, 0 insertions, 32 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
index 324d0b4608..f686334815 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/AbstractAction.java
@@ -61,7 +61,6 @@ public abstract class AbstractAction implements Action {
private Iterable<Artifact> inputs;
private final ImmutableSet<Artifact> outputs;
- private int cachedInputCount = -1;
private String cachedKey;
/**
@@ -131,21 +130,6 @@ public abstract class AbstractAction implements Action {
protected void setInputs(Iterable<Artifact> inputs) {
Preconditions.checkState(discoversInputs(), this);
this.inputs = CollectionUtils.makeImmutable(inputs);
- cachedInputCount = -1;
- }
-
- /*
- * Get count of inputs.
- *
- * <p>Computes the count on first invocation, returns cached value for further invocations.
- */
- @Override
- @ThreadSafe
- public synchronized int getInputCount() {
- if (cachedInputCount == -1) {
- cachedInputCount = Iterables.size(getInputs());
- }
- return cachedInputCount;
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java b/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java
index 64813aed07..b941a590e0 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionMetadata.java
@@ -97,9 +97,6 @@ public interface ActionMetadata {
/**
* Returns the input Artifacts that this Action depends upon. May be empty.
*
- * <p>For subclasses overriding getInputs(), if getInputs() could return different values in the
- * lifetime of an object, {@link #getInputCount()} must also be overridden.
- *
* <p>During execution, the {@link Iterable} returned by {@code getInputs} <em>must not</em> be
* concurrently modified before the value is fully read in {@code JavaDistributorDriver#exec} (via
* the {@code Iterable<ActionInput>} argument there). Violating this would require somewhat
@@ -111,13 +108,6 @@ public interface ActionMetadata {
Iterable<Artifact> getInputs();
/**
- * Returns the number of input Artifacts that this Action depends upon.
- *
- * <p>Must be consistent with {@link #getInputs()}.
- */
- int getInputCount();
-
- /**
* Returns the (unordered, immutable) set of output Artifacts that
* this action generates. (It would not make sense for this to be empty.)
*/
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java
index 9e9c180360..e652c9950c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestRunnerAction.java
@@ -18,7 +18,6 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.AbstractAction;
import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.ActionExecutionException;
@@ -181,11 +180,6 @@ public class TestRunnerAction extends AbstractAction implements NotifyOnActionCa
}
@Override
- public int getInputCount() {
- return Iterables.size(getInputs());
- }
-
- @Override
protected String computeKey() {
Fingerprint f = new Fingerprint();
f.addString(GUID);