diff options
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/scan')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java | 5 | ||||
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java | 9 |
2 files changed, 2 insertions, 12 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java index 05aa97c274f..4398c3dc3a8 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectBranches.java @@ -23,7 +23,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.CheckForNull; -import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; /** @@ -31,10 +30,7 @@ import javax.annotation.concurrent.Immutable; */ @Immutable public class ProjectBranches { - private final Map<String, BranchInfo> branches; - - @Nullable private final String defaultBranchName; public ProjectBranches(List<BranchInfo> branchInfos) { @@ -59,7 +55,6 @@ public class ProjectBranches { return branches.isEmpty(); } - @CheckForNull public String defaultBranchName() { return defaultBranchName; } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java index 9c3feab2c22..93132a99b65 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/branch/ProjectPullRequests.java @@ -32,16 +32,11 @@ import javax.annotation.concurrent.Immutable; */ @Immutable public class ProjectPullRequests { - + private static final BinaryOperator<PullRequestInfo> PICK_MOST_RECENT_ANALYSIS = (a, b) -> a.getAnalysisDate() < b.getAnalysisDate() ? b : a; private final Map<String, PullRequestInfo> pullRequestsByBranchName; public ProjectPullRequests(List<PullRequestInfo> pullRequestInfos) { - BinaryOperator<PullRequestInfo> mergeFunction = pickMostRecentAnalysis(); - this.pullRequestsByBranchName = pullRequestInfos.stream().collect(Collectors.toMap(PullRequestInfo::getBranch, Function.identity(), mergeFunction)); - } - - private static BinaryOperator<PullRequestInfo> pickMostRecentAnalysis() { - return (a, b) -> a.getAnalysisDate() < b.getAnalysisDate() ? b : a; + this.pullRequestsByBranchName = pullRequestInfos.stream().collect(Collectors.toMap(PullRequestInfo::getBranch, Function.identity(), PICK_MOST_RECENT_ANALYSIS)); } @CheckForNull |