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/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
index 5607782..67924f1 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
@@ -434,8 +434,7 @@
     }
     SkyValue value = result.get(key);
     if (value instanceof ActionExecutionValue) {
-      return ((ActionExecutionValue) value)
-          .getExistingFileArtifactValue((DerivedArtifact) artifact);
+      return ((ActionExecutionValue) value).getExistingFileArtifactValue(artifact);
     }
     return value;
   }