replace with emptyList()

This commit is contained in:
Alexey Kudravtsev
2010-07-02 14:23:03 +04:00
parent d331664ba6
commit ec7fcb5845
37 changed files with 133 additions and 125 deletions
@@ -36,7 +36,8 @@ public class GotoImplementationHandler extends GotoTargetHandler {
int offset = editor.getCaretModel().getOffset();
PsiElement source = TargetElementUtilBase.getInstance().findTargetElement(editor, ImplementationSearcher.getFlags(), offset);
if (source == null) return null;
return new GotoData(source, new ImplementationSearcher().searchImplementations(editor, source, offset), Collections.EMPTY_LIST);
return new GotoData(source, new ImplementationSearcher().searchImplementations(editor, source, offset),
Collections.<AdditionalAction>emptyList());
}
protected String getChooserTitle(PsiElement sourceElement, String name, int length) {
@@ -215,7 +215,7 @@ public class SemServiceImpl extends SemService{
return null;
}
if (cached != null && cached != Collections.EMPTY_LIST) {
if (cached != null && cached != Collections.<T>emptyList()) {
if (singleList == null) {
singleList = cached;
continue;
@@ -50,7 +50,7 @@ public class RevisionsList {
public RevisionsList(SelectionListener l) {
table = new JBTable();
table.setModel(new MyModel(Collections.EMPTY_LIST, Collections.EMPTY_MAP));
table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap()));
table.setTableHeader(null);
table.setShowGrid(false);
@@ -71,7 +71,7 @@ abstract class UndoRedo {
}
private Set<DocumentReference> getDecRefs() {
return myEditor == null ? Collections.EMPTY_SET : myManager.getDocumentReferences(myEditor);
return myEditor == null ? Collections.<DocumentReference>emptySet() : UndoManagerImpl.getDocumentReferences(myEditor);
}
protected abstract UndoRedoStacksHolder getStackHolder();
@@ -217,4 +217,4 @@ abstract class UndoRedo {
myEditor.setState(pair.getState());
return true;
}
}
}
@@ -142,7 +142,7 @@ public class OptionsEditorContext {
public Collection<Configurable> getChildren(final Configurable parent) {
Collection<Configurable> result = myParentToChildrenMap.get(parent);
return result == null ? Collections.EMPTY_SET : result;
return result == null ? Collections.<Configurable>emptySet() : result;
}
interface ColleagueAction {
@@ -490,7 +490,7 @@ public class OptionsTree extends JPanel implements Disposable, OptionsEditorColl
return result; // TODO: DECIDE IF INNERS SHOULD BE SORTED: sort(result);
}
else {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
}
@@ -20,23 +20,20 @@ import com.intellij.openapi.util.Condition;
import java.util.*;
import static org.junit.Assert.assertEquals;
public class ContainerUtilTest extends junit.framework.TestCase {
public void testFindInstanceOf() {
Iterator<Object> iterator = Arrays.asList(new Object[]{new Integer(1), new ArrayList(), "1"}).iterator();
String string = (String)com.intellij.util.containers.ContainerUtil
.find(iterator, com.intellij.util.containers.FilteringIterator.instanceOf(String.class));
Iterator<Object> iterator = Arrays.<Object>asList(new Integer(1), new ArrayList(), "1").iterator();
String string = (String)ContainerUtil.find(iterator, FilteringIterator.instanceOf(String.class));
junit.framework.Assert.assertEquals("1", string);
}
public void testConcatMulti() {
List l = ContainerUtil.concat(Arrays.asList(1, 2), Collections.EMPTY_LIST, Arrays.asList(3, 4));
List<Integer> l = ContainerUtil.concat(Arrays.asList(1, 2), Collections.EMPTY_LIST, Arrays.asList(3, 4));
assertEquals(4, l.size());
assertEquals(1, l.get(0));
assertEquals(2, l.get(1));
assertEquals(3, l.get(2));
assertEquals(4, l.get(3));
assertEquals(1, (int)l.get(0));
assertEquals(2, (int)l.get(1));
assertEquals(3, (int)l.get(2));
assertEquals(4, (int)l.get(3));
try {
l.get(-1);
@@ -66,7 +63,7 @@ public class ContainerUtilTest extends junit.framework.TestCase {
asserIterating(Arrays.asList(4), cond, 4);
}
private void asserIterating(List<Integer> collection, Condition<Integer> condition, Integer... expected) {
private static void asserIterating(List<Integer> collection, Condition<Integer> condition, Integer... expected) {
Iterable<Integer> it = ContainerUtil.iterate(collection, condition);
List<Integer> actual = new ArrayList<Integer>();
for (Integer each : it) {
@@ -95,7 +95,7 @@ public abstract class ConventionInspection extends BaseInspection {
private static final int REGEX_COLUMN_COUNT = 25;
public Collection<? extends JComponent> createExtraOptions() {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
@Override
@@ -221,4 +221,4 @@ public abstract class ConventionInspection extends BaseInspection {
return panel;
}
}
}
@@ -47,7 +47,7 @@ public class WeakestTypeFinder {
final PsiMethod method = (PsiMethod) variableOrMethod;
variableOrMethodType = method.getReturnType();
if (PsiType.VOID.equals(variableOrMethodType)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else {
throw new IllegalArgumentException(
@@ -55,14 +55,14 @@ public class WeakestTypeFinder {
variableOrMethod);
}
if (!(variableOrMethodType instanceof PsiClassType)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiClassType variableOrMethodClassType =
(PsiClassType) variableOrMethodType;
final PsiClass variableOrMethodClass =
variableOrMethodClassType.resolve();
if (variableOrMethodClass == null) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiManager manager = variableOrMethod.getManager();
final GlobalSearchScope scope = variableOrMethod.getResolveScope();
@@ -72,7 +72,7 @@ public class WeakestTypeFinder {
facade.findClass("java.lang.Object", scope);
if (javaLangObjectClass == null ||
variableOrMethodClass.equals(javaLangObjectClass)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
Set<PsiClass> weakestTypeClasses = new HashSet();
weakestTypeClasses.add(javaLangObjectClass);
@@ -95,21 +95,21 @@ public class WeakestTypeFinder {
if (referenceParent instanceof PsiExpressionList) {
if (!(referenceGrandParent instanceof
PsiMethodCallExpression)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiMethodCallExpression methodCallExpression =
(PsiMethodCallExpression) referenceGrandParent;
if (!findWeakestType(referenceElement, methodCallExpression,
useParameterizedTypeForCollectionMethods,
weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceGrandParent
instanceof PsiMethodCallExpression) {
final PsiMethodCallExpression methodCallExpression =
(PsiMethodCallExpression) referenceGrandParent;
if (!findWeakestType(methodCallExpression, weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiAssignmentExpression) {
final PsiAssignmentExpression assignmentExpression =
@@ -117,24 +117,24 @@ public class WeakestTypeFinder {
if (!findWeakestType(referenceElement, assignmentExpression,
useRighthandTypeAsWeakestTypeInAssignments,
weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiVariable) {
final PsiVariable variable = (PsiVariable)referenceParent;
final PsiType type = variable.getType();
if (!checkType(type, weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiForeachStatement) {
final PsiForeachStatement foreachStatement =
(PsiForeachStatement)referenceParent;
if (foreachStatement.getIteratedValue() != referenceElement) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiClass javaLangIterableClass =
facade.findClass("java.lang.Iterable", scope);
if (javaLangIterableClass == null) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
checkClass(javaLangIterableClass, weakestTypeClasses);
} else if (referenceParent instanceof PsiReturnStatement) {
@@ -142,11 +142,11 @@ public class WeakestTypeFinder {
PsiTreeUtil.getParentOfType(referenceParent,
PsiMethod.class);
if (containingMethod == null) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiType type = containingMethod.getReturnType();
if (!checkType(type, weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiReferenceExpression) {
// field access, method call is handled above.
@@ -154,7 +154,7 @@ public class WeakestTypeFinder {
(PsiReferenceExpression)referenceParent;
final PsiElement target = referenceExpression.resolve();
if (!(target instanceof PsiField)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiField field = (PsiField)target;
final PsiClass containingClass = field.getContainingClass();
@@ -164,14 +164,14 @@ public class WeakestTypeFinder {
(PsiArrayInitializerExpression)referenceParent;
if (!findWeakestType(arrayInitializerExpression,
weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiThrowStatement) {
final PsiThrowStatement throwStatement =
(PsiThrowStatement)referenceParent;
if (!findWeakestType(throwStatement, variableOrMethodClass,
weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiConditionalExpression) {
final PsiConditionalExpression conditionalExpression =
@@ -179,12 +179,12 @@ public class WeakestTypeFinder {
final PsiExpression condition =
conditionalExpression.getCondition();
if (referenceElement.equals(condition)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiType type = ExpectedTypeUtils.findExpectedType(
conditionalExpression, true);
if (!checkType(type, weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
} else if (referenceParent instanceof PsiBinaryExpression) {
// strings only
@@ -193,28 +193,28 @@ public class WeakestTypeFinder {
final PsiType type = binaryExpression.getType();
if (variableOrMethodType.equals(type)) {
if (!checkType(type, weakestTypeClasses)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
}
} else if (referenceParent instanceof PsiSwitchStatement) {
// only enums and primitives can be a switch expression
return Collections.EMPTY_LIST;
return Collections.emptyList();
} else if (referenceParent instanceof PsiPrefixExpression) {
// only primitives and boxed types are the target of a prefix
// expression
return Collections.EMPTY_LIST;
return Collections.emptyList();
} else if (referenceParent instanceof PsiPostfixExpression) {
// only primitives and boxed types are the target of a postfix
// expression
return Collections.EMPTY_LIST;
return Collections.emptyList();
} else if (referenceParent instanceof PsiIfStatement) {
// only booleans and boxed Booleans are the condition of an if
// statement
return Collections.EMPTY_LIST;
return Collections.emptyList();
} else if (referenceParent instanceof PsiForStatement) {
// only booleans and boxed Booleans are the condition of an
// for statement
return Collections.EMPTY_LIST;
return Collections.emptyList();
} else if (referenceParent instanceof PsiNewExpression) {
final PsiNewExpression newExpression =
(PsiNewExpression)referenceParent;
@@ -222,12 +222,12 @@ public class WeakestTypeFinder {
if (qualifier != null) {
final PsiType type = newExpression.getType();
if (!(type instanceof PsiClassType)) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiClassType classType = (PsiClassType)type;
final PsiClass innerClass = classType.resolve();
if (innerClass == null) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
final PsiClass outerClass =
innerClass.getContainingClass();
@@ -238,11 +238,11 @@ public class WeakestTypeFinder {
}
if (weakestTypeClasses.contains(variableOrMethodClass) ||
weakestTypeClasses.isEmpty()) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
}
if (!hasUsages) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
weakestTypeClasses =
filterAccessibleClasses(weakestTypeClasses, variableOrMethod);
@@ -30,7 +30,7 @@ public class ReturnOfCollectionFieldInspection
public List<String> fooBarEmpty()
{
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
public int[] bar()
@@ -39,4 +39,4 @@ public class ReturnOfCollectionFieldInspection
}
}
}
@@ -158,7 +158,7 @@ public class VariableAccessUtils {
public static Set<PsiVariable> collectUsedVariables(
PsiElement context) {
if (context == null) {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
final VariableCollectingVisitor visitor =
new VariableCollectingVisitor();
@@ -187,4 +187,4 @@ public class VariableAccessUtils {
return usedVariables;
}
}
}
}
@@ -83,7 +83,7 @@ final class FileSystemScanner {
private List<DirectoryObject> scanDirectory(DirectoryObject directoryObject, CvsFiles cvsFiles) throws IOException {
if (!clientEnvironment.getLocalFileReader().exists(directoryObject, clientEnvironment.getCvsFileSystem())) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
cvsFiles.add(CvsFile.createCvsDirectory(directoryObject));
@@ -76,7 +76,7 @@ public final class AdminReader
return entriesHandler.getEntries().getEntries();
}
catch (FileNotFoundException ex) {
return Collections.EMPTY_SET;
return Collections.emptySet();
}
}
@@ -121,7 +121,7 @@ public class MavenModelConverter {
}
private static List<String> ensurePatterns(List<String> patterns) {
return patterns == null ? Collections.EMPTY_LIST : patterns;
return patterns == null ? Collections.<String>emptyList() : patterns;
}
private static List<MavenRemoteRepository> convertRepositories(List<Repository> repositories) {
@@ -282,7 +282,7 @@ public class MavenModelConverter {
}
private static Element xppToElement(Xpp3Dom xpp) {
Element result = null;
Element result;
try {
result = new Element(xpp.getName());
}
@@ -83,7 +83,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"<version>1</version>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.execute(myProjectPom, Collections.EMPTY_LIST, Arrays.asList("compile"));
MavenWrapperExecutionResult result = myEmbedder.execute(myProjectPom, Collections.<String>emptyList(), Arrays.asList("compile"));
assertNotNull(result.projectData);
assertNotNull(new File(getProjectPath(), "target").exists());
@@ -108,7 +108,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts);
@@ -124,7 +124,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"<version>1</version>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
MavenModel project = result.projectData.mavenModel;
assertNotNull(project);
@@ -160,7 +160,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</build>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts);
@@ -192,7 +192,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts);
@@ -245,7 +245,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
@@ -267,7 +267,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
@@ -285,7 +285,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"<version>1</version>" +
"<packaging>pom</packaging>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
myEmbedder.execute(m, Collections.EMPTY_LIST, Arrays.asList("install"));
myEmbedder.execute(m, Collections.<String>emptyList(), Arrays.asList("install"));
myEmbedder.reset();
File fooParentFile = new File(repo, "test/foo-parent/1/foo-parent-1.pom");
assertTrue(fooParentFile.exists());
@@ -300,7 +300,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
" <version>1</version>" +
"</parent>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
myEmbedder.execute(m, Collections.EMPTY_LIST, Arrays.asList("install"));
myEmbedder.execute(m, Collections.<String>emptyList(), Arrays.asList("install"));
myEmbedder.reset();
assertTrue(new File(repo, "test/foo/1/foo-1.pom").exists());
@@ -320,7 +320,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result.projectData);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("test", "foo-parent", "1"));
@@ -342,7 +342,7 @@ public class MavenFacadeEmbedderTest extends MavenImportingTestCase {
"</dependencies>");
myEmbedder.customizeForResolve(new SoutMavenConsole(), EMPTY_MAVEN_PROCESS);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.EMPTY_LIST);
MavenWrapperExecutionResult result = myEmbedder.resolveProject(myProjectPom, Collections.<String>emptyList());
assertNotNull(result);
assertOrderedElementsAreEqual(result.unresolvedArtifacts, new MavenId("fff", "zzz", "666"));
@@ -351,11 +351,11 @@ public class MavenProjectsNavigator extends SimpleProjectComponent implements Pe
public void projectResolved(Pair<MavenProject, MavenProjectChanges> projectWithChanges,
NativeMavenProjectHolder nativeMavenProject,
Object message) {
scheduleUpdateProjects(Collections.singletonList(projectWithChanges.first), Collections.EMPTY_LIST);
scheduleUpdateProjects(Collections.singletonList(projectWithChanges.first), Collections.<MavenProject>emptyList());
}
public void pluginsResolved(MavenProject project) {
scheduleUpdateProjects(Collections.singletonList(project), Collections.EMPTY_LIST);
scheduleUpdateProjects(Collections.singletonList(project), Collections.<MavenProject>emptyList());
}
private void scheduleUpdateProjects(final List<MavenProject> projects, final List<MavenProject> deleted) {
@@ -640,7 +640,7 @@ public class MavenProjectsManager extends SimpleProjectComponent
myWatcher.scheduleUpdateAll(force, forceImport);
}
else {
myWatcher.scheduleUpdate(MavenUtil.collectFiles(projects), Collections.EMPTY_LIST, force, forceImport);
myWatcher.scheduleUpdate(MavenUtil.collectFiles(projects), Collections.<VirtualFile>emptyList(), force, forceImport);
}
}
});
@@ -981,7 +981,7 @@ public class MavenProjectsManager extends SimpleProjectComponent
try {
MavenUtil.run(myProject, "Downloading dependency...", new MavenTask() {
public void run(MavenProgressIndicator indicator) throws MavenProcessCanceledException {
artifact[0] = myProjectsTree.downloadArtifact(mavenProject, id, myEmbeddersManager, new SoutMavenConsole(), indicator);
artifact[0] = MavenProjectsTree.downloadArtifact(mavenProject, id, myEmbeddersManager, new SoutMavenConsole(), indicator);
}
});
}
@@ -671,7 +671,7 @@ public class MavenProjectsTree {
});
}
private long getFileTimestamp(VirtualFile file) {
private static long getFileTimestamp(VirtualFile file) {
if (file == null || !file.isValid()) return -1;
return file.getTimeStamp();
}
@@ -1085,7 +1085,7 @@ public class MavenProjectsTree {
}
}
public MavenArtifact downloadArtifact(MavenProject mavenProject,
public static MavenArtifact downloadArtifact(MavenProject mavenProject,
MavenId id,
MavenEmbeddersManager embeddersManager,
MavenConsole console,
@@ -1226,13 +1226,13 @@ public class MavenProjectsTree {
public void fireUpdatedIfNecessary(Object message) {
if (updatedProjectsWithChanges.isEmpty() && deletedProjects.isEmpty()) return;
fireProjectsUpdated(updatedProjectsWithChanges.isEmpty()
? Collections.EMPTY_LIST
: MavenUtil.mapToList(updatedProjectsWithChanges),
deletedProjects.isEmpty()
? Collections.EMPTY_LIST
: new ArrayList<MavenProject>(deletedProjects),
message);
List<MavenProject> mavenProjects = deletedProjects.isEmpty()
? Collections.<MavenProject>emptyList()
: new ArrayList<MavenProject>(deletedProjects);
List<Pair<MavenProject, MavenProjectChanges>> updated = updatedProjectsWithChanges.isEmpty()
? Collections.<Pair<MavenProject, MavenProjectChanges>>emptyList()
: MavenUtil.mapToList(updatedProjectsWithChanges);
fireProjectsUpdated(updated, mavenProjects, message);
}
}
@@ -1240,7 +1240,7 @@ public class MavenProjectsTree {
void run(MavenEmbedderWrapper embedder) throws MavenProcessCanceledException;
}
public static abstract class Visitor<Result> {
public abstract static class Visitor<Result> {
private Result result;
public boolean shouldVisit(MavenProject project) {
@@ -1265,7 +1265,7 @@ public class MavenProjectsTree {
}
}
public static abstract class SimpleVisitor extends Visitor<Object> {
public abstract static class SimpleVisitor extends Visitor<Object> {
}
private static class MavenProjectTimestamp {
@@ -26,7 +26,7 @@ import java.util.List;
public class OpenOrCreateSettingsXmlAction extends MavenOpenOrCreateFilesAction {
protected List<File> getFiles(AnActionEvent e) {
File file = MavenActionUtil.getProjectsManager(e.getDataContext()).getGeneralSettings().getEffectiveUserSettingsIoFile();
return file != null ? Collections.singletonList(file) : Collections.EMPTY_LIST;
return file != null ? Collections.singletonList(file) : Collections.<File>emptyList();
}
@Override
@@ -155,7 +155,7 @@ public class MavenProjectBuilder extends ProjectImportBuilder<MavenProject> {
for (VirtualFile f : getParameters().myFiles) {
MavenProject project = new MavenProject(f);
process.setText2(ProjectBundle.message("maven.reading.pom", f.getPath()));
project.read(generalSettings, Collections.EMPTY_LIST, reader, locator);
project.read(generalSettings, Collections.<String>emptyList(), reader, locator);
uniqueProfiles.addAll(project.getProfilesIds());
}
getParameters().myProfiles = new ArrayList<String>(uniqueProfiles);
@@ -33,7 +33,7 @@ public abstract class MavenPerformanceTest extends MavenImportingTestCase {
super.setUp();
VirtualFile file = LocalFileSystem.getInstance().findFileByPath("C:\\projects\\mvn\\_projects\\geronimo\\pom.xml");
initProjectsManager(false);
myProjectsManager.resetManagedFilesAndProfilesInTests(Collections.singletonList(file), Collections.EMPTY_LIST);
myProjectsManager.resetManagedFilesAndProfilesInTests(Collections.singletonList(file), Collections.<String>emptyList());
}
public void testReading() throws Exception {
@@ -48,14 +48,18 @@ public class MavenIndicesManagerTest extends MavenIndicesTestCase {
File dir3 = myIndicesFixture.getRepositoryHelper().getTestData("dir\\foo\\");
File dir4 = myIndicesFixture.getRepositoryHelper().getTestData("dir/bar");
List<MavenIndex> indices1 = myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir1, Collections.EMPTY_LIST);
List<MavenIndex> indices1 = myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir1,
Collections.<Pair<String, String>>emptyList());
assertEquals(1, indices1.size());
assertTrue(myIndicesFixture.getIndicesManager().getIndices().contains(indices1.get(0)));
assertEquals(indices1, myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir2, Collections.EMPTY_LIST));
assertEquals(indices1, myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir3, Collections.EMPTY_LIST));
assertEquals(indices1, myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir2,
Collections.<Pair<String, String>>emptyList()));
assertEquals(indices1, myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir3,
Collections.<Pair<String, String>>emptyList()));
List<MavenIndex> indices2 = myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir4, Collections.EMPTY_LIST);
List<MavenIndex> indices2 = myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, dir4,
Collections.<Pair<String, String>>emptyList());
assertFalse(indices1.get(0).equals(indices2.get(0)));
}
@@ -81,7 +85,7 @@ public class MavenIndicesManagerTest extends MavenIndicesTestCase {
public void testIndexedArchetypes() throws Exception {
myIndicesFixture.getRepositoryHelper().addTestData("archetypes");
myIndicesFixture.getIndicesManager().ensureIndicesExist(myProject, myIndicesFixture.getRepositoryHelper().getTestData("archetypes"),
Collections.EMPTY_LIST);
Collections.<Pair<String, String>>emptyList());
assertArchetypeExists("org.apache.maven.archetypes:maven-archetype-foobar:1.0");
}
@@ -122,4 +126,4 @@ public class MavenIndicesManagerTest extends MavenIndicesTestCase {
}
assertTrue(actualNames.toString(), actualNames.contains(archetypeId));
}
}
}
@@ -50,7 +50,7 @@ public class MavenProjectsNavigatorTest extends MavenImportingTestCase {
createModulePom("m", "<groupId>test</groupId>" +
"<artifactId>m</artifactId>" +
"<version>1</version>");
myProjectsManager.resetManagedFilesAndProfilesInTests(Collections.singletonList(myProjectPom), Collections.EMPTY_LIST);
myProjectsManager.resetManagedFilesAndProfilesInTests(Collections.singletonList(myProjectPom), Collections.<String>emptyList());
waitForReadingCompletion();
myProjectsManager.fireActivatedInTests();
@@ -220,10 +220,10 @@ public class MavenProjectReaderTest extends MavenTestCase {
assertPathEquals(pathFromBasedir("src/test/java"), p.getBuild().getTestSources().get(0));
assertEquals(1, p.getBuild().getResources().size());
assertResource(p.getBuild().getResources().get(0), pathFromBasedir("src/main/resources"),
false, null, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
false, null, Collections.<String>emptyList(), Collections.<String>emptyList());
assertEquals(1, p.getBuild().getTestResources().size());
assertResource(p.getBuild().getTestResources().get(0), pathFromBasedir("src/test/resources"),
false, null, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
false, null, Collections.<String>emptyList(), Collections.<String>emptyList());
assertPathEquals(pathFromBasedir("target"), p.getBuild().getDirectory());
assertPathEquals(pathFromBasedir("target/classes"), p.getBuild().getOutputDirectory());
assertPathEquals(pathFromBasedir("target/test-classes"), p.getBuild().getTestOutputDirectory());
@@ -319,7 +319,7 @@ public class MavenProjectReaderTest extends MavenTestCase {
true, "dir", Collections.singletonList("**.properties"), Collections.singletonList("**.xml"));
assertEquals(1, p.getBuild().getTestResources().size());
assertResource(p.getBuild().getTestResources().get(0), pathFromBasedir("myTestRes"),
false, null, Collections.singletonList("**.properties"), Collections.EMPTY_LIST);
false, null, Collections.singletonList("**.properties"), Collections.<String>emptyList());
assertPathEquals(pathFromBasedir("myOutput"), p.getBuild().getDirectory());
assertPathEquals(pathFromBasedir("myClasses"), p.getBuild().getOutputDirectory());
assertPathEquals(pathFromBasedir("myTestClasses"), p.getBuild().getTestOutputDirectory());
@@ -391,10 +391,10 @@ public class MavenProjectReaderTest extends MavenTestCase {
assertPathEquals(pathFromBasedir("subDir/myTestSrc"), p.getBuild().getTestSources().get(0));
assertEquals(1, p.getBuild().getResources().size());
assertResource(p.getBuild().getResources().get(0), pathFromBasedir("subDir/myRes"),
false, null, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
false, null, Collections.<String>emptyList(), Collections.<String>emptyList());
assertEquals(1, p.getBuild().getTestResources().size());
assertResource(p.getBuild().getTestResources().get(0), pathFromBasedir("subDir/myTestRes"),
false, null, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
false, null, Collections.<String>emptyList(), Collections.<String>emptyList());
assertPathEquals(pathFromBasedir("subDir/myOutput"), p.getBuild().getDirectory());
assertPathEquals(pathFromBasedir("subDir/myClasses"), p.getBuild().getOutputDirectory());
assertPathEquals(pathFromBasedir("subDir/myTestClasses"), p.getBuild().getTestOutputDirectory());
@@ -59,7 +59,7 @@ public class MavenProjectsTreeIgnoresTest extends MavenProjectsTreeTestCase {
assertEquals("ignored: m1 ", myLog);
myLog = "";
myTree.setIgnoredFilesPatterns(Collections.EMPTY_LIST);
myTree.setIgnoredFilesPatterns(Collections.<String>emptyList());
assertEquals("unignored: m1 ", myLog);
myLog = "";
@@ -92,4 +92,4 @@ public class MavenProjectsTreeIgnoresTest extends MavenProjectsTreeTestCase {
}, ", ");
}
}
}
}
@@ -89,7 +89,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent {
private void addGroup(final ProxyGroup template) {
final ProxyGroup group;
if (template == null) {
group = new ProxyGroup(getNewName(), "", Collections.EMPTY_MAP);
group = new ProxyGroup(getNewName(), "", Collections.<String, String>emptyMap());
} else {
group = new ProxyGroup(getNewName(), template.getPatterns(), template.getProperties());
}
@@ -260,7 +260,7 @@ public class SvnConfigureProxiesComponent extends MasterDetailsComponent {
myRoot.removeAllChildren();
DefaultProxyGroup defaultProxyGroup = myManager.getDefaultGroup();
defaultProxyGroup = (defaultProxyGroup == null) ? new DefaultProxyGroup(Collections.EMPTY_MAP) : defaultProxyGroup;
defaultProxyGroup = (defaultProxyGroup == null) ? new DefaultProxyGroup(Collections.<String, String>emptyMap()) : defaultProxyGroup;
final Map<String, ProxyGroup> userGroups = myManager.getGroups();
myRoot.add(createNodeForObject(defaultProxyGroup));
@@ -86,7 +86,7 @@ class IntroduceParameterProcessor extends BaseRefactoringProcessor {
usageCount += callsToUpdate.size();
} else {
//noinspection unchecked
callsToUpdate = Collections.EMPTY_LIST;
callsToUpdate = Collections.emptyList();
}
final UsageInfo[] usageInfos = new UsageInfo[usageCount];
@@ -35,7 +35,7 @@ public class ParamMatcher extends BaseMatcher {
public ParamMatcher(XmlTag parent, String name) {
myRoot = parent;
myName = name;
myExcludedNames = Collections.EMPTY_SET;
myExcludedNames = Collections.emptySet();
}
public ParamMatcher(XmlTag root, String[] excludedNames, String name) {
@@ -40,8 +40,8 @@ public final class HistoryElement implements Copyable<HistoryElement> {
@SuppressWarnings({"unchecked"})
private HistoryElement() {
expression = null;
variables = Collections.EMPTY_SET;
namespaces = Collections.EMPTY_SET;
variables = Collections.emptySet();
namespaces = Collections.emptySet();
}
public boolean equals(Object o) {
@@ -148,7 +148,7 @@ public class FindByXPathAction extends AnAction {
private static boolean validateExpression(Project project, String expression) {
try {
//noinspection unchecked
XPathSupport.getInstance().createXPath(null, expression, Collections.EMPTY_LIST);
XPathSupport.getInstance().createXPath(null, expression, Collections.<org.intellij.plugins.xpathView.util.Namespace>emptyList());
return true;
} catch (XPathSyntaxException e) {
Messages.showErrorDialog(project, e.getMultilineMessage(), "XPath Syntax Error");
@@ -50,7 +50,7 @@ public class PsiDocumentNavigator extends DefaultNavigator {
}
if (!(contextNode instanceof XmlElement)) {
return Collections.EMPTY_LIST.iterator();
return Collections.emptyList().iterator();
}
return new PsiChildAxisIterator(contextNode);
}
@@ -62,7 +62,7 @@ public class PsiDocumentNavigator extends DefaultNavigator {
}
if (!(contextNode instanceof XmlElement)) {
return Collections.EMPTY_LIST.iterator();
return Collections.emptyList().iterator();
}
return new NodeIterator((XmlElement)contextNode) {
@@ -183,7 +183,7 @@ public class PsiDocumentNavigator extends DefaultNavigator {
if (isElement(contextNode)) {
return new AttributeIterator((XmlElement)contextNode);
} else {
return Collections.EMPTY_LIST.iterator();
return Collections.emptyList().iterator();
}
}
@@ -74,7 +74,7 @@ class XPathFunctionProviderImpl extends XPathFunctionProvider {
return myFunctions;
} else {
//noinspection unchecked
return Collections.EMPTY_MAP;
return Collections.emptyMap();
}
}
@@ -86,7 +86,7 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
private final ComboBox myComboBox = new ComboBox();
private JComponent myEditorComponent;
private @Nullable Set<Namespace> myNamespaceCache;
@Nullable private Set<Namespace> myNamespaceCache;
private InteractiveContextProvider myContextProvider;
private final PsiFile myXPathFile;
@@ -163,8 +163,8 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
n = selectedItem.namespaces;
v = selectedItem.variables;
} else {
n = Collections.EMPTY_SET;
v = Collections.EMPTY_SET;
n = Collections.emptySet();
v = Collections.emptySet();
}
// FIXME
@@ -231,7 +231,7 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
final PsiReference[] references = element.getReferences();
for (PsiReference reference : references) {
if (reference instanceof PrefixReference) {
final PrefixReference prefixReference = ((PrefixReference)reference);
final PrefixReference prefixReference = (PrefixReference)reference;
if (prefixReference.isUnresolved()) {
prefixes.add(prefixReference.getPrefix());
}
@@ -378,7 +378,7 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
if (myNamespaceCache != null) {
return Namespace.makeMap(myNamespaceCache);
} else {
return Collections.EMPTY_MAP;
return Collections.emptyMap();
}
}
@@ -397,8 +397,8 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
public Context getContext() {
final HistoryElement context = myModel.getSelectedItem();
if (context == null || context.expression == null) {
final Set<Namespace> cache = myNamespaceCache != null ? myNamespaceCache : Collections.EMPTY_SET;
return new Context(new HistoryElement(myDocument.getText(), Collections.EMPTY_SET, cache), getMode());
final Set<Namespace> cache = myNamespaceCache != null ? myNamespaceCache : Collections.<Namespace>emptySet();
return new Context(new HistoryElement(myDocument.getText(), Collections.<Variable>emptySet(), cache), getMode());
}
final Collection<Namespace> namespaces = myNamespaceCache != null ?
@@ -536,8 +536,8 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
@Nullable
public String getPrefixForURI(String uri, XmlElement context) {
final java.util.List<String> list = myMap.getKeysByValue(uri);
return list != null && list.size() > 0 ? list.get(0) : null;
final List<String> list = myMap.getKeysByValue(uri);
return list != null && !list.isEmpty() ? list.get(0) : null;
}
@NotNull
@@ -617,7 +617,7 @@ public abstract class InputExpressionDialog<FormType extends InputForm> extends
} else {
n = Collections.singleton(namespace);
//noinspection unchecked
v = Collections.EMPTY_SET;
v = Collections.emptySet();
}
updateContext(n, v);
@@ -112,7 +112,7 @@ public class HighlighterUtil {
public static List<RangeHighlighter> getHighlighters(Editor editor) {
if (!hasHighlighters(editor)) {
//noinspection unchecked
return Collections.EMPTY_LIST;
return Collections.emptyList();
} else {
return editor.getUserData(HIGHLIGHTERS_KEY);
}
@@ -125,7 +125,7 @@ public class NamespaceCollector extends XmlRecursiveElementVisitor {
public static CollectedInfo empty() {
//noinspection unchecked
return new CollectedInfo(Collections.EMPTY_SET, Collections.EMPTY_SET, Collections.EMPTY_SET);
return new CollectedInfo(Collections.<Namespace>emptySet(), Collections.<QName>emptySet(), Collections.<QName>emptySet());
}
public static CollectedInfo collectInfo(final XmlFile psiFile) {
@@ -112,7 +112,13 @@ public class DynamicGenericInfo extends DomGenericInfoEx {
if (!collections.isEmpty()) {
ChildrenDescriptionsHolder<CollectionChildDescriptionImpl> newCollections = new ChildrenDescriptionsHolder<CollectionChildDescriptionImpl>(myStaticGenericInfo.getCollections());
for (final DomExtensionImpl extension : collections) {
newCollections.addDescription(extension.addAnnotations(new CollectionChildDescriptionImpl(extension.getXmlName(), extension.getType(), Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST)));
newCollections.addDescription(extension.addAnnotations(new CollectionChildDescriptionImpl(extension.getXmlName(), extension.getType(),
Collections.<JavaMethod>emptyList(),
Collections.<JavaMethod>emptyList(),
Collections.<JavaMethod>emptyList(),
Collections.<JavaMethod>emptyList(),
Collections.<JavaMethod>emptyList(),
Collections.<JavaMethod>emptyList())));
}
clearSubTags = true;
myCollections = newCollections;
@@ -151,14 +151,14 @@ public class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper {
List<String> myRootValues;
if (psifile == null) {
configureComboBox(rootElementChooser, Collections.EMPTY_LIST);
configureComboBox(rootElementChooser, Collections.<String>emptyList());
return;
}
final XmlTag rootTag = getRootTag(psifile);
if (rootTag == null) {
configureComboBox(rootElementChooser, Collections.EMPTY_LIST);
configureComboBox(rootElementChooser, Collections.<String>emptyList());
rootElementChooser.setSelectedIndex(-1);
previousUri = uri;
return;