Skip to content

Commit

Permalink
Rename a method to improve code clarity.
Browse files Browse the repository at this point in the history
Methods that return collections should have plural names.

(cherry picked from commit 58f05e8)
  • Loading branch information
Googler authored and mai93 committed Jul 17, 2023
1 parent 9356537 commit 8c21d04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public abstract class ArtifactInfo {
public abstract ImmutableList<Path> genSrcs();

/** Workspace relative sources for this dependency, extracted at dependency build time. */
public abstract ImmutableSet<Path> source();
public abstract ImmutableSet<Path> sources();

public static ArtifactInfo create(TargetArtifacts proto) {
// Note, the proto contains a list of sources, we take the parent as we want directories instead
Expand All @@ -71,7 +71,7 @@ public TargetArtifacts toProto() {
.addAllJars(jars().stream().map(Path::toString).collect(toImmutableList()))
.addAllIdeAars(ideAars().stream().map(Path::toString).collect(toImmutableList()))
.addAllGenSrcs(genSrcs().stream().map(Path::toString).collect(toImmutableList()))
.addAllSrcs(source().stream().map(Path::toString).collect(toImmutableList()))
.addAllSrcs(sources().stream().map(Path::toString).collect(toImmutableList()))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public ImmutableSet<Path> getTargetSources(Path cachedArtifact) {
Path artifactPath = cachePathToArtifactKeyMap.get(cachedArtifact);
return artifacts.values().stream()
.filter(d -> d.containsPath(artifactPath))
.map(ArtifactInfo::source)
.map(ArtifactInfo::sources)
.flatMap(Set::stream)
.collect(toImmutableSet());
}
Expand Down

0 comments on commit 8c21d04

Please sign in to comment.