This commit is contained in:
Alexey Kudravtsev
2018-11-29 13:24:54 +03:00
parent 3e4024127f
commit 00d481ab9b
15 changed files with 28 additions and 25 deletions
@@ -72,7 +72,7 @@ public class CompositeScope extends ExportableUserDataHolderBase implements Comp
}
@Override
public boolean belongs(String url) {
public boolean belongs(@NotNull String url) {
for (CompileScope scope : myScopes) {
if (scope.belongs(url)) {
return true;
@@ -34,7 +34,7 @@ import java.util.*;
public class FileSetCompileScope extends ExportableUserDataHolderBase implements CompileScope {
private final Set<VirtualFile> myRootFiles = new HashSet<>();
private final Set<String> myDirectoryUrls = new HashSet<>();
private Set<String> myUrls = null; // urls caching
private Set<String> myUrls; // urls caching
private final Module[] myAffectedModules;
public FileSetCompileScope(final Collection<VirtualFile> files, Module[] modules) {
@@ -82,7 +82,7 @@ public class FileSetCompileScope extends ExportableUserDataHolderBase implements
}
@Override
public boolean belongs(String url) {
public boolean belongs(@NotNull String url) {
//url = CompilerUtil.normalizePath(url, '/');
if (getUrls().contains(url)) {
return true;
@@ -97,7 +97,7 @@ public class ModuleCompileScope extends FileIndexCompileScope {
}
@Override
public boolean belongs(final String url) {
public boolean belongs(@NotNull final String url) {
if (myScopeModules.isEmpty() && myIncludedUnloadedModules.isEmpty()) {
return false; // optimization
}
@@ -62,7 +62,7 @@ public class OneProjectItemCompileScope extends ExportableUserDataHolderBase imp
}
@Override
public boolean belongs(String url) {
public boolean belongs(@NotNull String url) {
if (myFile.isDirectory()){
return FileUtil.startsWith(url, myUrl);
}
@@ -42,7 +42,7 @@ public class ProjectCompileScope extends FileIndexCompileScope {
}
@Override
public boolean belongs(String url) {
public boolean belongs(@NotNull String url) {
final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
if (file != null) {
for (FileIndex index : getFileIndices()) {
@@ -1,7 +1,6 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.compiler.options;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
import com.intellij.compiler.CompilerConfiguration;
import com.intellij.compiler.CompilerConfigurationImpl;
import com.intellij.compiler.impl.javaCompiler.BackendCompiler;
@@ -149,7 +148,6 @@ public class JavaCompilersTab implements SearchableConfigurable, Configurable.No
finally {
BuildManager.getInstance().clearState(myProject);
PsiManager.getInstance(myProject).dropPsiCaches();
DaemonCodeAnalyzer.getInstance(myProject).restart();
}
}
@@ -50,7 +50,7 @@ public interface CompileScope extends ExportableUserDataHolder {
* @return true if the url specified belongs to the scope, false otherwise.
* Note: the method may be time-consuming.
*/
boolean belongs(String url);
boolean belongs(@NotNull String url);
/**
* Returns the list of modules files in which belong to the scope.
@@ -32,6 +32,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.*;
public class CyclicDependenciesBuilder{
@NotNull
private final Project myProject;
private final AnalysisScope myScope;
private final Map<String, PsiPackage> myPackages = new HashMap<>();
@@ -45,7 +46,7 @@ public class CyclicDependenciesBuilder{
private String myRootNodeNameInUsageView;
public CyclicDependenciesBuilder(final Project project, final AnalysisScope scope) {
public CyclicDependenciesBuilder(@NotNull Project project, final AnalysisScope scope) {
myProject = project;
myScope = scope;
myForwardBuilder = new ForwardDependenciesBuilder(myProject, myScope){
@@ -69,6 +70,7 @@ public class CyclicDependenciesBuilder{
myRootNodeNameInUsageView = rootNodeNameInUsageView;
}
@NotNull
public Project getProject() {
return myProject;
}
@@ -67,6 +67,7 @@ public final class PackageElement implements Queryable, RootsProvider {
return roots;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PackageElement)) return false;
@@ -80,10 +81,10 @@ public final class PackageElement implements Queryable, RootsProvider {
return true;
}
@Override
public int hashCode() {
int result;
result = (myModule != null ? myModule.hashCode() : 0);
result = 29 * result + (myElement.hashCode());
int result = myModule != null ? myModule.hashCode() : 0;
result = 29 * result + myElement.hashCode();
result = 29 * result + (myIsLibraryElement ? 1 : 0);
return result;
}
@@ -287,6 +287,7 @@ public class GlobalSearchScopesCore {
return super.uniteWith(scope);
}
@NotNull
private static Set<VirtualFile> union(boolean addDir1, @NotNull VirtualFile dir1, boolean addDir2, @NotNull VirtualFile dir2) {
if (addDir1 && addDir2) return ContainerUtil.newHashSet(dir1, dir2);
if (addDir1) return Collections.singleton(dir1);
@@ -839,7 +839,7 @@ public abstract class GlobalSearchScope extends SearchScope implements ProjectAw
Project project = getProject();
myHasFilesOutOfProjectRoots = result =
project != null && !project.isDefault() &&
myFiles.stream().anyMatch(file -> FileIndexFacade.getInstance(project).getModuleForFile(file) == null);
ContainerUtil.find(myFiles, file -> FileIndexFacade.getInstance(project).getModuleForFile(file) != null) == null;
}
return result;
}
@@ -111,6 +111,7 @@ public class LocalSearchScope extends SearchScope {
return myVirtualFiles;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof LocalSearchScope)) return false;
@@ -195,6 +196,7 @@ public class LocalSearchScope extends SearchScope {
return null;
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
for (int i = 0; i < myScope.length; i++) {
@@ -257,11 +259,11 @@ public class LocalSearchScope extends SearchScope {
return commonParent;
}
public boolean isInScope(VirtualFile file) {
public boolean isInScope(@NotNull VirtualFile file) {
return ArrayUtil.indexOf(myVirtualFiles, file) != -1;
}
public boolean containsRange(PsiFile file, @NotNull TextRange range) {
public boolean containsRange(@NotNull PsiFile file, @NotNull TextRange range) {
for (PsiElement element : getScope()) {
if (file == element.getContainingFile() && element.getTextRange().contains(range)) {
return true;
@@ -291,8 +293,5 @@ public class LocalSearchScope extends SearchScope {
? EMPTY
: new LocalSearchScope(PsiUtilCore.toPsiElementArray(result), scope.getDisplayName(), scope.isIgnoreInjectedPsi());
});
}
}
@@ -115,7 +115,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
return null;
}
protected FileElement derefTreeElement() {
FileElement derefTreeElement() {
return myTrees.derefTreeElement();
}
@@ -337,7 +337,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
}
@Override
@SuppressWarnings({"CloneDoesntCallSuperClone"})
@SuppressWarnings("CloneDoesntCallSuperClone")
protected PsiFileImpl clone() {
FileViewProvider viewProvider = getViewProvider();
FileViewProvider providerCopy = viewProvider.clone();
@@ -990,7 +990,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
putInfo(this, info);
}
public static void putInfo(PsiFile psiFile, Map<String, String> info) {
public static void putInfo(@NotNull PsiFile psiFile, @NotNull Map<String, String> info) {
info.put("fileName", psiFile.getName());
info.put("fileType", psiFile.getFileType().toString());
}
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.packageDependencies.DependenciesBuilder;
import com.intellij.packageDependencies.ForwardDependenciesBuilder;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import java.util.Collections;
import java.util.HashSet;
@@ -31,7 +32,7 @@ import java.util.Set;
public class AnalyzeDependenciesHandler extends DependenciesHandlerBase {
private final int myTransitiveBorder;
public AnalyzeDependenciesHandler(Project project, List<? extends AnalysisScope> scopes, int transitiveBorder, Set<PsiFile> excluded) {
public AnalyzeDependenciesHandler(@NotNull Project project, List<? extends AnalysisScope> scopes, int transitiveBorder, Set<PsiFile> excluded) {
super(project, scopes, excluded);
myTransitiveBorder = transitiveBorder;
}
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.packageDependencies.BackwardDependenciesBuilder;
import com.intellij.packageDependencies.DependenciesBuilder;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
@@ -32,11 +33,11 @@ import java.util.Set;
public class BackwardDependenciesHandler extends DependenciesHandlerBase {
private final AnalysisScope myScopeOfInterest;
public BackwardDependenciesHandler(Project project, AnalysisScope scope, final AnalysisScope selectedScope) {
public BackwardDependenciesHandler(@NotNull Project project, AnalysisScope scope, final AnalysisScope selectedScope) {
this(project, Collections.singletonList(scope), selectedScope, new HashSet<>());
}
public BackwardDependenciesHandler(final Project project, final List<? extends AnalysisScope> scopes, final @Nullable AnalysisScope scopeOfInterest, Set<PsiFile> excluded) {
public BackwardDependenciesHandler(@NotNull Project project, final List<? extends AnalysisScope> scopes, @Nullable final AnalysisScope scopeOfInterest, Set<PsiFile> excluded) {
super(project, scopes, excluded);
myScopeOfInterest = scopeOfInterest;
}