Accidental collection modification fixed

This commit is contained in:
Andrey Breslav
2013-10-01 20:12:42 +04:00
parent eb5455e89f
commit 02e76bd805
2 changed files with 6 additions and 5 deletions
@@ -50,6 +50,7 @@ import org.jetbrains.jet.plugin.util.ApplicationUtils;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
public final class AnalyzerFacadeWithCache { public final class AnalyzerFacadeWithCache {
@@ -131,7 +132,7 @@ public final class AnalyzerFacadeWithCache {
Project project = file.getProject(); Project project = file.getProject();
Collection<JetFile> files = JetFilesProvider.getInstance(project).allInScope(GlobalSearchScope.allScope(project)); Collection<JetFile> files = new HashSet<JetFile>(JetFilesProvider.getInstance(project).allInScope(GlobalSearchScope.allScope(project)));
// Add requested file to the list of files for searching declarations // Add requested file to the list of files for searching declarations
files.add(file); files.add(file);
@@ -43,9 +43,7 @@ import org.jetbrains.jet.lang.resolve.java.JetFilesProvider;
import org.jetbrains.jet.plugin.JetFileType; import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.plugin.JetPluginUtil; import org.jetbrains.jet.plugin.JetPluginUtil;
import java.util.Collection; import java.util.*;
import java.util.HashSet;
import java.util.Set;
public class PluginJetFilesProvider extends JetFilesProvider { public class PluginJetFilesProvider extends JetFilesProvider {
private final Project project; private final Project project;
@@ -145,7 +143,9 @@ public class PluginJetFilesProvider extends JetFilesProvider {
} }
}); });
return Sets.newHashSet(Collections2.filter(jetFiles, Predicates.<JetFile>notNull())); return Collections.unmodifiableCollection(
Sets.newHashSet(Collections2.filter(jetFiles, Predicates.<JetFile>notNull()))
);
} }
@Override @Override