From 70823b8b79a7060b5b9ce27513194e57fe96bcde Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 30 Jul 2012 15:41:13 +0400 Subject: [PATCH] notnull, nullable --- .../vcs/impl/ContentRevisionCache.java | 3 +- .../src/git4idea/GitContentRevision.java | 32 +++++++++---------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/impl/ContentRevisionCache.java b/platform/vcs-api/src/com/intellij/openapi/vcs/impl/ContentRevisionCache.java index 5dc1948d8da6..b5f1389648fe 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/impl/ContentRevisionCache.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/impl/ContentRevisionCache.java @@ -16,7 +16,6 @@ package com.intellij.openapi.vcs.impl; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Getter; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.Throwable2Computable; import com.intellij.openapi.vcs.FilePath; @@ -143,7 +142,7 @@ public class ContentRevisionCache { VcsRevisionNumber number, VcsKey key, UniqueType type, - Throwable2Computable loader, Charset charset) + Throwable2Computable loader, @Nullable Charset charset) throws VcsException, IOException { if (charset == null) { return getOrLoadAsString(project, file, number, key, type, loader); diff --git a/plugins/git4idea/src/git4idea/GitContentRevision.java b/plugins/git4idea/src/git4idea/GitContentRevision.java index 9f1c759d0902..43dd52ca5f98 100644 --- a/plugins/git4idea/src/git4idea/GitContentRevision.java +++ b/plugins/git4idea/src/git4idea/GitContentRevision.java @@ -59,9 +59,10 @@ public class GitContentRevision implements ContentRevision { /** * The charset for the file */ - private Charset myCharset; + @Nullable private Charset myCharset; - protected GitContentRevision(@NotNull FilePath file, @NotNull GitRevisionNumber revision, @NotNull Project project, Charset charset) { + protected GitContentRevision(@NotNull FilePath file, @NotNull GitRevisionNumber revision, @NotNull Project project, + @Nullable Charset charset) { myProject = project; myFile = file; myRevision = revision; @@ -168,8 +169,8 @@ public class GitContentRevision implements ContentRevision { } public static ContentRevision createRevisionForTypeChange(@NotNull Project project, @NotNull VirtualFile vcsRoot, - @NotNull String path, - @Nullable VcsRevisionNumber revisionNumber, boolean unescapePath) throws VcsException { + @NotNull String path, @Nullable VcsRevisionNumber revisionNumber, + boolean unescapePath) throws VcsException { final FilePath filePath; if (revisionNumber == null) { File file = new File(makeAbsolutePath(vcsRoot, path, unescapePath)); @@ -181,7 +182,8 @@ public class GitContentRevision implements ContentRevision { return createRevision(filePath, revisionNumber, project); } - public static FilePath createPath(VirtualFile vcsRoot, String path, boolean isDeleted, boolean canBeDeleted, boolean unescapePath) throws VcsException { + public static FilePath createPath(@NotNull VirtualFile vcsRoot, @NotNull String path, + boolean isDeleted, boolean canBeDeleted, boolean unescapePath) throws VcsException { final String absolutePath = makeAbsolutePath(vcsRoot, path, unescapePath); FilePath file = isDeleted ? VcsUtil.getFilePathForDeletedFile(absolutePath, false) : VcsUtil.getFilePath(absolutePath, false); if (canBeDeleted && (! SystemInfo.isFileSystemCaseSensitive) && VcsUtil.caseDiffers(file.getPath(), absolutePath)) { @@ -191,25 +193,24 @@ public class GitContentRevision implements ContentRevision { return file; } - private static String makeAbsolutePath(VirtualFile vcsRoot, String path, boolean unescapePath) throws VcsException { + private static String makeAbsolutePath(@NotNull VirtualFile vcsRoot, @NotNull String path, boolean unescapePath) throws VcsException { final String unescapedPath = unescapePath ? GitUtil.unescapePath(path) : path; return vcsRoot.getPath() + "/" + unescapedPath; } - public static ContentRevision createRevision(final VirtualFile file, final VcsRevisionNumber revisionNumber, final Project project) - throws VcsException { + public static ContentRevision createRevision(@NotNull final VirtualFile file, @Nullable final VcsRevisionNumber revisionNumber, + @NotNull final Project project) throws VcsException { return createRevision(file, revisionNumber, project, null); } - public static ContentRevision createRevision(final VirtualFile file, final VcsRevisionNumber revisionNumber, final Project project, - final Charset charset) - throws VcsException { + public static ContentRevision createRevision(@NotNull final VirtualFile file, @Nullable final VcsRevisionNumber revisionNumber, + @NotNull final Project project, @Nullable final Charset charset) throws VcsException { final FilePathImpl filePath = new FilePathImpl(file); return createRevision(filePath, revisionNumber, project, charset); } - public static ContentRevision createRevision(final FilePath filePath, final VcsRevisionNumber revisionNumber, final Project project, - final Charset charset) { + public static ContentRevision createRevision(@NotNull final FilePath filePath, @Nullable final VcsRevisionNumber revisionNumber, + @NotNull final Project project, @Nullable final Charset charset) { if (revisionNumber != null && revisionNumber != VcsRevisionNumber.NULL) { return createRevisionImpl(filePath, (GitRevisionNumber)revisionNumber, project, charset); } @@ -218,9 +219,8 @@ public class GitContentRevision implements ContentRevision { } } - private static GitContentRevision createRevisionImpl(FilePath path, - GitRevisionNumber revisionNumber, - Project project, final Charset charset) { + private static GitContentRevision createRevisionImpl(@NotNull FilePath path, @NotNull GitRevisionNumber revisionNumber, + @NotNull Project project, @Nullable final Charset charset) { if (path.getFileType().isBinary()) { return new GitBinaryContentRevision(path, revisionNumber, project); } else {