From d565f84067fb351eea537bf108e87ac230e1fbf9 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Wed, 7 Mar 2012 18:46:17 +0400 Subject: [PATCH] Fix warnings, @NotNull --- .../src/git4idea/update/GitUpdater.java | 48 ++++++++----------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/plugins/git4idea/src/git4idea/update/GitUpdater.java b/plugins/git4idea/src/git4idea/update/GitUpdater.java index ff64539a3a0c..a70dd29aa586 100644 --- a/plugins/git4idea/src/git4idea/update/GitUpdater.java +++ b/plugins/git4idea/src/git4idea/update/GitUpdater.java @@ -43,21 +43,18 @@ import java.util.Map; public abstract class GitUpdater { private static final Logger LOG = Logger.getInstance(GitUpdater.class); - protected final Project myProject; - protected final VirtualFile myRoot; - protected final Map myTrackedBranches; - protected final ProgressIndicator myProgressIndicator; - protected final UpdatedFiles myUpdatedFiles; - protected final AbstractVcsHelper myVcsHelper; + protected final @NotNull Project myProject; + protected final @NotNull VirtualFile myRoot; + protected final @NotNull Map myTrackedBranches; + protected final @NotNull ProgressIndicator myProgressIndicator; + protected final @NotNull UpdatedFiles myUpdatedFiles; + protected final @NotNull AbstractVcsHelper myVcsHelper; protected final GitVcs myVcs; protected GitRevisionNumber myBefore; // The revision that was before update - protected GitUpdater(Project project, - VirtualFile root, - Map trackedBranches, - ProgressIndicator progressIndicator, - UpdatedFiles updatedFiles) { + protected GitUpdater(@NotNull Project project, @NotNull VirtualFile root, @NotNull Map trackedBranches, + @NotNull ProgressIndicator progressIndicator, @NotNull UpdatedFiles updatedFiles) { myProject = project; myRoot = root; myTrackedBranches = trackedBranches; @@ -69,18 +66,12 @@ public abstract class GitUpdater { /** * Returns proper updater based on the update policy (merge or rebase) selected by user or stored in his .git/config - * - * - * @param gitUpdateProcess - * @param root - * @param progressIndicator * @return {@link GitMergeUpdater} or {@link GitRebaseUpdater}. */ - public static GitUpdater getUpdater(Project project, - Map trackedBranches, - VirtualFile root, - ProgressIndicator progressIndicator, - UpdatedFiles updatedFiles) { + @NotNull + public static GitUpdater getUpdater(@NotNull Project project, @NotNull Map trackedBranches, + @NotNull VirtualFile root, @NotNull ProgressIndicator progressIndicator, + @NotNull UpdatedFiles updatedFiles) { final GitVcsSettings settings = GitVcsSettings.getInstance(project); if (settings == null) { return getDefaultUpdaterForBranch(project, root, trackedBranches, progressIndicator, updatedFiles); @@ -97,11 +88,10 @@ public abstract class GitUpdater { return getDefaultUpdaterForBranch(project, root, trackedBranches, progressIndicator, updatedFiles); } - private static GitUpdater getDefaultUpdaterForBranch(Project project, - VirtualFile root, - Map trackedBranches, - ProgressIndicator progressIndicator, - UpdatedFiles updatedFiles) { + @NotNull + private static GitUpdater getDefaultUpdaterForBranch(@NotNull Project project, @NotNull VirtualFile root, + @NotNull Map trackedBranches, + @NotNull ProgressIndicator progressIndicator, @NotNull UpdatedFiles updatedFiles) { try { final GitBranch branchName = GitBranch.current(project, root); final String rebase = GitConfigUtil.getValue(project, root, "branch." + branchName + ".rebase"); @@ -114,6 +104,7 @@ public abstract class GitUpdater { return new GitMergeUpdater(project, root, trackedBranches, progressIndicator, updatedFiles); } + @NotNull public GitUpdateResult update() throws VcsException { markStart(myRoot); try { @@ -138,8 +129,9 @@ public abstract class GitUpdater { public boolean isUpdateNeeded() throws VcsException { GitBranchPair gitBranchPair = myTrackedBranches.get(myRoot); String currentBranch = gitBranchPair.getBranch().getName(); - assert gitBranchPair.getDest() != null; - String remoteBranch = gitBranchPair.getDest().getName(); + GitBranch dest = gitBranchPair.getDest(); + assert dest != null; + String remoteBranch = dest.getName(); if (! hasRemotelyChangedPaths(currentBranch, remoteBranch)) { LOG.info("isSaveNeeded No remote changes, save is not needed"); return false;