Clean up artifact retrieval methods in ActionExecutionValue.

All callers of getArtifactValue were doing a checkNotNull on the return value, which is exactly what getExistingFileArtifactValue does. Migrate them so that we only need one retrieval method. Loosen the parameter to Artifact and do the instanceof check in one place, so any bugs get an appropriate error message.

Additionally, use the recently added isChildOfDeclaredDirectory method to determine which map to search for the artifact, instead of unnecessarily checking both.

RELNOTES: None.
PiperOrigin-RevId: 314380367
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
index f260515..c611700 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalFunction.java
@@ -22,7 +22,6 @@
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
 import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Artifact.DerivedArtifact;
 import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
 import com.google.devtools.build.lib.actions.FileArtifactValue;
 import com.google.devtools.build.lib.actions.FileStateType;
@@ -278,9 +277,7 @@
         if (value instanceof FileArtifactValue || value instanceof TreeArtifactValue) {
           fsVal = (HasDigest) value;
         } else if (value instanceof ActionExecutionValue) {
-          fsVal =
-              ((ActionExecutionValue) value)
-                  .getExistingFileArtifactValue((DerivedArtifact) artifact);
+          fsVal = ((ActionExecutionValue) value).getExistingFileArtifactValue(artifact);
         } else {
           return NON_EXISTENT_FILE_INFO;
         }