diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/RefCountHolder.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/RefCountHolder.java index dc9be261626f..7ebb225ec25d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/RefCountHolder.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/RefCountHolder.java @@ -71,7 +71,7 @@ class RefCountHolder { private static final Key> REF_COUNT_HOLDER_IN_FILE_KEY = Key.create("REF_COUNT_HOLDER_IN_FILE_KEY"); @NotNull - public static RefCountHolder get(@NotNull PsiFile file) { + static RefCountHolder get(@NotNull PsiFile file) { Reference ref = file.getUserData(REF_COUNT_HOLDER_IN_FILE_KEY); RefCountHolder holder = com.intellij.reference.SoftReference.dereference(ref); if (holder == null) { @@ -171,7 +171,7 @@ class RefCountHolder { } } - public boolean isReferenced(@NotNull PsiElement element) { + boolean isReferenced(@NotNull PsiElement element) { Collection array; synchronized (myLocalRefsMap) { array = myLocalRefsMap.get(element); @@ -272,10 +272,10 @@ class RefCountHolder { return false; } - public boolean analyze(@NotNull PsiFile file, - TextRange dirtyScope, - @NotNull ProgressIndicator indicator, - @NotNull Runnable analyze) { + boolean analyze(@NotNull PsiFile file, + TextRange dirtyScope, + @NotNull ProgressIndicator indicator, + @NotNull Runnable analyze) { ProgressIndicator result; if (myState.compareAndSet(EMPTY, indicator)) { if (!file.getTextRange().equals(dirtyScope)) { diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java index f25ee9a6b264..2b96628fa861 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/FileStatusMap.java @@ -351,6 +351,11 @@ public class FileStatusMap implements Disposable { public void putUserData(@NotNull Key key, @Nullable T value) { throw new UnsupportedOperationException(); } + + @Override + public String toString() { + return "WHOLE_FILE"; + } }; // logging diff --git a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java index 2752d06b31d4..f4eca37a558e 100644 --- a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java +++ b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java @@ -241,8 +241,8 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi @NotNull public FileElement[] getKnownTreeRoots() { PsiFile psiFile = getCachedPsi(myBaseLanguage); - if (psiFile == null || !(psiFile instanceof PsiFileImpl)) return new FileElement[0]; - if (((PsiFileImpl)psiFile).getTreeElement() == null) return new FileElement[0]; + if (!(psiFile instanceof PsiFileImpl)) return FileElement.EMPTY_ARRAY; + if (((PsiFileImpl)psiFile).getTreeElement() == null) return FileElement.EMPTY_ARRAY; return new FileElement[]{(FileElement)psiFile.getNode()}; } @@ -528,9 +528,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi if (document == null) { return LoadTextUtil.loadText(virtualFile); } - else { - return getLastCommittedText(document); - } + return getLastCommittedText(document); } @Override @@ -546,9 +544,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi if (document == null) { return virtualFile.getModificationStamp(); } - else { - return getLastCommittedStamp(document); - } + return getLastCommittedStamp(document); } @NonNls @@ -567,7 +563,7 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi private class PsiFileContent implements Content { private final PsiFileImpl myFile; - private volatile String myContent = null; + private volatile String myContent; private final long myModificationStamp; @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/FileElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/FileElement.java index 894d0295870c..ff2a0f8cef15 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/FileElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/FileElement.java @@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class FileElement extends LazyParseableElement implements FileASTNode, Getter { + public static final FileElement[] EMPTY_ARRAY = new FileElement[0]; private volatile CharTable myCharTable = new CharTableImpl(); private volatile boolean myDetached;