@@ -82,9 +82,12 @@ public final class RuleConfiguredTarget extends AbstractConfiguredTarget {
82
82
private final RuleClassId ruleClassId ;
83
83
84
84
/**
85
- * Operations accessing actions, for example, executing them should be performed in the same Bazel
86
- * instance that constructs the {@code RuleConfiguredTarget} instance and not on a Bazel instance
87
- * that retrieves it remotely using deserialization.
85
+ * Operations accessing actions (for example, executing them or looking up metadata in them)
86
+ * should be performed in the same Bazel instance that constructs the {@code RuleConfiguredTarget}
87
+ * instance and not on a Bazel instance that retrieves the {@code RuleConfiguredTarget} remotely
88
+ * using deserialization, because actions will be null then.
89
+ *
90
+ * <p>Prefer using {@link #getActions()} which guards against null actions with a clear error.
88
91
*/
89
92
@ Nullable // Null if deserialized.
90
93
private final transient ImmutableList <ActionAnalysisMetadata > actions ;
@@ -254,7 +257,7 @@ protected Object rawGetStarlarkProvider(String providerKey) {
254
257
// Only expose actions which are legitimate Starlark values, otherwise they will later
255
258
// cause a Bazel crash.
256
259
// TODO(cparsons): Expose all actions to Starlark.
257
- return actions .stream ()
260
+ return getActions () .stream ()
258
261
.filter (action -> action instanceof ActionApi )
259
262
.collect (ImmutableList .toImmutableList ());
260
263
}
@@ -299,7 +302,7 @@ public Artifact findArtifactByOutputLabel(Label outputLabel) {
299
302
outputLabel ,
300
303
this );
301
304
PathFragment relativeOutputPath = outputLabel .toPathFragment ();
302
- for (ActionAnalysisMetadata action : actions ) {
305
+ for (ActionAnalysisMetadata action : getActions () ) {
303
306
for (Artifact output : action .getOutputs ()) {
304
307
if (output .getExecPath ().endsWith (relativeOutputPath )) {
305
308
return output ;
0 commit comments