Skip to content

Commit

Permalink
Remove redundant array initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Aug 21, 2023
1 parent 6ffc702 commit fc39dbe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/api/messages/GoblintMessagesResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public List<AnalysisResult> convert(List<Tag> tags, String severity, boolean exp
GoblintPosition pos = getLocation(loc);
String msg = joinTags(tags) + " " + text;
GoblintMessagesAnalysisResult result = new GoblintMessagesAnalysisResult(pos, msg, severity);
return new ArrayList<>(List.of(result));
return List.of(result);
}
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public List<AnalysisResult> convertGroupExplode(List<Tag> tags, String severity)
List<GoblintMessagesAnalysisResult> resultsWithoutRelated =
pieces.stream().map(piece -> new GoblintMessagesAnalysisResult(getLocation(piece.loc), groupText, piece.text, severity)).toList();
// Add related warnings to all the pieces in the group
List<GoblintMessagesAnalysisResult> resultsWithRelated = new ArrayList<>();
List<AnalysisResult> resultsWithRelated = new ArrayList<>();
for (GoblintMessagesAnalysisResult result : resultsWithoutRelated) {
resultsWithRelated.add(
new GoblintMessagesAnalysisResult(
Expand All @@ -114,7 +114,7 @@ public List<AnalysisResult> convertGroupExplode(List<Tag> tags, String severity)
.map(res -> Pair.make(res.position(), res.text()))
.toList()));
}
return new ArrayList<>(resultsWithRelated);
return resultsWithRelated;
}

public List<AnalysisResult> convertGroup(List<Tag> tags, String severity) {
Expand All @@ -132,7 +132,7 @@ public List<AnalysisResult> convertGroup(List<Tag> tags, String severity) {
.orElse(getLocation(group_loc));
GoblintMessagesAnalysisResult result =
new GoblintMessagesAnalysisResult(pos, joinTags(tags) + " " + group_text, severity, relatedFromPieces);
return new ArrayList<>(List.of(result));
return List.of(result);
}
}

Expand Down

0 comments on commit fc39dbe

Please sign in to comment.