Skip to content

Commit

Permalink
Make default return value static
Browse files Browse the repository at this point in the history
  • Loading branch information
moroten committed Sep 18, 2024
1 parent 5c62f76 commit a5f4189
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,10 @@ static String unescape(String str) {
}

private static class DigestWriter {
// Input value map to force repo invalidation.
private static final ImmutableMap<RepoRecordedInput, String> NOT_UP_TO_DATE = ImmutableMap.of(
RepoRecordedInput.NEVER_UP_TO_DATE, "");

private final BlazeDirectories directories;
private final Path markerPath;
private final Rule rule;
Expand Down Expand Up @@ -702,8 +706,6 @@ private static Map<RepoRecordedInput, String> readMarkerFile(
String content, String expectedRuleKey) {
Iterable<String> lines = Splitter.on('\n').split(content);

ImmutableMap<RepoRecordedInput, String> notUpToDate = ImmutableMap.of(
RepoRecordedInput.NEVER_UP_TO_DATE, "");
@Nullable Map<RepoRecordedInput, String> recordedInputValues = null;
boolean firstLineVerified = false;
for (String line : lines) {
Expand All @@ -714,7 +716,7 @@ private static Map<RepoRecordedInput, String> readMarkerFile(
if (!line.equals(expectedRuleKey)) {
// Break early, need to reload anyway. This also detects marker file version changes
// so that unknown formats are not parsed.
return notUpToDate;
return NOT_UP_TO_DATE;
}
firstLineVerified = true;
recordedInputValues = new TreeMap<>();
Expand All @@ -728,11 +730,11 @@ private static Map<RepoRecordedInput, String> readMarkerFile(
}
}
// On parse failure, just forget everything else and mark the whole input out of date.
return notUpToDate;
return NOT_UP_TO_DATE;
}
}
if (!firstLineVerified) {
return notUpToDate;
return NOT_UP_TO_DATE;
}
return Preconditions.checkNotNull(recordedInputValues);
}
Expand Down

0 comments on commit a5f4189

Please sign in to comment.