emptyIterator() used; misc warning fixes
authorTagir Valeev <Tagir.Valeev@jetbrains.com>
Wed, 26 Dec 2018 03:52:15 +0000 (10:52 +0700)
committerTagir Valeev <Tagir.Valeev@jetbrains.com>
Wed, 26 Dec 2018 04:57:56 +0000 (11:57 +0700)
java/java-impl/src/com/intellij/cyclicDependencies/CyclicDependenciesBuilder.java
java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationLabeler.java
platform/boot/src/com/intellij/lang/properties/charset/Native2AsciiCharsetProvider.java
platform/lang-impl/src/com/intellij/ide/todo/TodoPanel.java
platform/lang-impl/src/com/intellij/ide/todo/TodoTreeBuilder.java
platform/util/testSrc/com/intellij/util/containers/SequenceIteratorTest.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/ArraysAsListWithZeroOrOneArgumentFixTest.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomElement.java
plugins/ant/src/com/intellij/lang/ant/dom/AntDomExtender.java
plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/support/jaxen/PsiDocumentNavigator.java

index aec2bfc91b29b0ae9ed7e2bc8a604426c84c933f..1965b14fd51c7583c1d3019c0099cc768f441978 100644 (file)
@@ -251,7 +251,7 @@ public class CyclicDependenciesBuilder{
       public Iterator<PsiPackage> getIn(PsiPackage psiPack) {
         final Set<PsiPackage> psiPackages = myPackageDependencies.get(psiPack);
         if (psiPackages == null) {     //for packs without java classes
-          return new HashSet<PsiPackage>().iterator();
+          return Collections.emptyIterator();
         }
         return psiPackages.iterator();
       }
index f113d9d69018c2702a0dbaa9229afd63e8b266eb..c44b7fccd315e1938c5de19c4529345cafbb5c0c 100644 (file)
@@ -96,7 +96,7 @@ public class TypeMigrationLabeler {
   }
 
   public boolean hasFailedConversions() {
-    return myFailedConversions.size() > 0;
+    return !myFailedConversions.isEmpty();
   }
 
   public Function<PsiElement, PsiType> getMigrationRootTypeFunction() {
@@ -217,7 +217,7 @@ public class TypeMigrationLabeler {
         public Iterator<TypeMigrationUsageInfo> getIn(TypeMigrationUsageInfo n) {
           final HashSet<Pair<TypeMigrationUsageInfo, PsiType>> rawNodes = myRootsTree.get(n);
           if (rawNodes == null) {
-            return Collections.<TypeMigrationUsageInfo>emptyList().iterator();
+            return Collections.emptyIterator();
           }
           final List<TypeMigrationUsageInfo> in =
             ContainerUtil.map(rawNodes, pair -> pair.getFirst());
@@ -257,7 +257,7 @@ public class TypeMigrationLabeler {
       if (res != 0) {
         return res;
       }
-      return range2.getStartOffset() - range1.getStartOffset();
+      return Integer.compare(range2.getStartOffset(), range1.getStartOffset());
     });
 
     return infos;
@@ -897,27 +897,25 @@ public class TypeMigrationLabeler {
     for (PsiReference ref1 : refs) {
       final PsiElement ref = ref1.getElement();
 
-      if (ref != null) {
-        if (element instanceof PsiMethod) {
-          final PsiElement parent = Util.getEssentialParent(ref);
+      if (element instanceof PsiMethod) {
+        final PsiElement parent = Util.getEssentialParent(ref);
 
-          if (!(parent instanceof PsiMethodCallExpression)) {
-            continue;
-          }
-
-          getTypeEvaluator().setType(new TypeMigrationUsageInfo(parent), migrationType);
-        }
-        else if (element instanceof PsiVariable) {
-          if (ref instanceof PsiReferenceExpression) {
-            getTypeEvaluator().setType(new TypeMigrationUsageInfo(ref), PsiUtil.captureToplevelWildcards(migrationType, ref));
-          }
-        }
-        else {
-          LOG.error("Method call expression or reference expression expected but found " + element.getClass().getName());
+        if (!(parent instanceof PsiMethodCallExpression)) {
           continue;
         }
-        validReferences.add(ref1);
+
+        getTypeEvaluator().setType(new TypeMigrationUsageInfo(parent), migrationType);
+      }
+      else if (element instanceof PsiVariable) {
+        if (ref instanceof PsiReferenceExpression) {
+          getTypeEvaluator().setType(new TypeMigrationUsageInfo(ref), PsiUtil.captureToplevelWildcards(migrationType, ref));
+        }
+      }
+      else {
+        LOG.error("Method call expression or reference expression expected but found " + element.getClass().getName());
+        continue;
       }
+      validReferences.add(ref1);
     }
 
     Collections.sort(validReferences, Comparator.comparingInt(o -> o.getElement().getTextOffset()));
@@ -983,7 +981,7 @@ public class TypeMigrationLabeler {
 
   void migrateRootUsageExpression(final PsiReference usage, final Set<? super PsiElement> processed) {
     final PsiElement ref = usage.getElement();
-    if (ref != null && ref.getLanguage() == JavaLanguage.INSTANCE) {
+    if (ref.getLanguage() == JavaLanguage.INSTANCE) {
       final PsiElement element = getContainingStatement(ref);
       if (element != null && !processed.contains(element)) {
         processed.add(element);
@@ -1086,7 +1084,7 @@ public class TypeMigrationLabeler {
     }
 
     if (autoMigrate) {
-      while (myMigrationRoots.size() > 0) {
+      while (!myMigrationRoots.isEmpty()) {
         iterate();
       }
     }
index 98d99a8e8002eb9d6e5c1753f01291f6a01188c0..b7fd306691d20efba9c408dd4a1059febc1b2560 100644 (file)
@@ -35,6 +35,6 @@ public class Native2AsciiCharsetProvider extends CharsetProvider {
 
   @Override
   public Iterator<Charset> charsets() {
-    return Collections.<Charset>emptyList().iterator();
+    return Collections.emptyIterator();
   }
 }
\ No newline at end of file
index afd3156fa7382a664d87423d6abad442460cd777..c5a89660ce3150b7b518663c0940fa22e2e13184 100644 (file)
@@ -25,7 +25,6 @@ import com.intellij.openapi.ui.SimpleToolWindowPanel;
 import com.intellij.openapi.ui.Splitter;
 import com.intellij.openapi.ui.popup.JBPopupFactory;
 import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.wm.impl.VisibilityWatcher;
 import com.intellij.psi.PsiDocumentManager;
@@ -57,7 +56,6 @@ import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 import java.awt.*;
-import java.awt.event.InputEvent;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
 import java.util.ArrayList;
@@ -113,7 +111,7 @@ abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavig
   private TodoTreeBuilder setupTreeStructure() {
     TodoTreeBuilder todoTreeBuilder = createTreeBuilder(myTree, myProject);
     TodoTreeStructure structure = todoTreeBuilder.getTodoTreeStructure();
-    StructureTreeModel structureTreeModel = new StructureTreeModel(structure, TodoTreeBuilder.MyComparator.ourInstance);
+    StructureTreeModel structureTreeModel = new StructureTreeModel(structure, TodoTreeBuilder.NODE_DESCRIPTOR_COMPARATOR);
     AsyncTreeModel asyncTreeModel = new AsyncTreeModel(structureTreeModel, myProject);
     myTree.setModel(asyncTreeModel);
     asyncTreeModel.addTreeModelListener(new MyExpandListener(todoTreeBuilder));
index f2abb47a7fb4357648feb355640ae7e45e0ef459..4e2e87dfff14fe90ce072e43224b6cd78dec87fa 100644 (file)
@@ -62,6 +62,8 @@ import java.util.*;
  */
 public abstract class TodoTreeBuilder implements Disposable {
   private static final Logger LOG = Logger.getInstance("#com.intellij.ide.todo.TodoTreeBuilder");
+  public static final Comparator<NodeDescriptor> NODE_DESCRIPTOR_COMPARATOR =
+      Comparator.<NodeDescriptor>comparingInt(NodeDescriptor::getWeight).thenComparingInt(NodeDescriptor::getIndex);  
   protected final Project myProject;
 
   /**
@@ -158,7 +160,7 @@ public abstract class TodoTreeBuilder implements Disposable {
     if (myUpdatable != updatable) {
       myUpdatable = updatable;
       if (updatable) {
-        DumbService.getInstance(myProject).runWhenSmart(() -> updateTree());
+        DumbService.getInstance(myProject).runWhenSmart(this::updateTree);
       }
     }
   }
@@ -276,7 +278,7 @@ public abstract class TodoTreeBuilder implements Disposable {
     * @see FileTree#getFiles(VirtualFile)
     */
    public Iterator<PsiFile> getFiles(Module module) {
-    if (module.isDisposed()) return Collections.<PsiFile>emptyList().iterator();
+    if (module.isDisposed()) return Collections.emptyIterator();
     ArrayList<PsiFile> psiFileList = new ArrayList<>();
     final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
     final VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
@@ -521,7 +523,7 @@ public abstract class TodoTreeBuilder implements Disposable {
   /**
    * Sets new {@code TodoFilter}, rebuild whole the caches and immediately update the tree.
    *
-   * @see TodoTreeStructure#setTodoFilter
+   * @see TodoTreeStructure#setTodoFilter(TodoFilter)
    */
   void setTodoFilter(TodoFilter filter) {
     getTodoTreeStructure().setTodoFilter(filter);
@@ -559,7 +561,7 @@ public abstract class TodoTreeBuilder implements Disposable {
       return null;
     }
     Object[] children = getTodoTreeStructure().getChildElements(parent);
-    Arrays.sort(children, (Comparator)MyComparator.ourInstance);
+    Arrays.sort(children, (Comparator)NODE_DESCRIPTOR_COMPARATOR);
     int idx = -1;
     for (int i = 0; i < children.length; i++) {
       if (obj.equals(children[i])) {
@@ -605,7 +607,7 @@ public abstract class TodoTreeBuilder implements Disposable {
       return null;
     }
     Object[] children = getTodoTreeStructure().getChildElements(parent);
-    Arrays.sort(children, (Comparator)MyComparator.ourInstance);
+    Arrays.sort(children, (Comparator)NODE_DESCRIPTOR_COMPARATOR);
     int idx = -1;
     for (int i = 0; i < children.length; i++) {
       if (obj.equals(children[i])) {
@@ -643,22 +645,6 @@ public abstract class TodoTreeBuilder implements Disposable {
   public boolean isDirectoryEmpty(@NotNull PsiDirectory psiDirectory){
     return myFileTree.isDirectoryEmpty(psiDirectory.getVirtualFile());
   }
-  
-  protected static final class MyComparator implements Comparator<NodeDescriptor> {
-    public static final Comparator<NodeDescriptor> ourInstance = new MyComparator();
-
-    @Override
-    public int compare(NodeDescriptor descriptor1, NodeDescriptor descriptor2) {
-      int weight1 = descriptor1.getWeight();
-      int weight2 = descriptor2.getWeight();
-      if (weight1 != weight2) {
-        return weight1 - weight2;
-      }
-      else {
-        return descriptor1.getIndex() - descriptor2.getIndex();
-      }
-    }
-  }
 
   private final class MyPsiTreeChangeListener extends PsiTreeChangeAdapter {
     @Override
index 2f6b7ed2852099d9f46399a00ea6d761e0063f10..967fcb40559a4abe4b3bf445e123e529277adb3f 100644 (file)
@@ -19,10 +19,7 @@ package com.intellij.util.containers;
 import com.intellij.util.Assertion;
 import junit.framework.TestCase;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
 
 public class SequenceIteratorTest extends TestCase {
   private final Assertion CHECK = new Assertion();
@@ -57,8 +54,8 @@ public class SequenceIteratorTest extends TestCase {
     return Arrays.asList(new Object[]{first, second}).iterator();
   }
 
-  private static Iterator empty() {
-    return new ArrayList().iterator();
+  private static Iterator<Object> empty() {
+    return Collections.emptyIterator();
   }
 
   public void testSimple() {
@@ -76,7 +73,7 @@ public class SequenceIteratorTest extends TestCase {
   }
 
   public void testOne() {
-    final Iterator<Integer> iterator = compose(Arrays.asList(iter(arr1)));
+    final Iterator<Integer> iterator = compose(Collections.singletonList(iter(arr1)));
     int cnt = 0;
     while (iterator.hasNext()) {
       iterator.next();
@@ -86,7 +83,7 @@ public class SequenceIteratorTest extends TestCase {
   }
 
   public void testOneOne() {
-    final Iterator<Integer> iterator = compose(Arrays.asList(iter(new Integer[]{1})));
+    final Iterator<Integer> iterator = compose(Collections.singletonList(iter(new Integer[]{1})));
     int cnt = 0;
     while (iterator.hasNext()) {
       iterator.next();
@@ -96,7 +93,7 @@ public class SequenceIteratorTest extends TestCase {
   }
 
   public void testEmpty() {
-    final Iterator<Integer> iterator = compose(Arrays.asList(iter(new Integer[]{})));
+    final Iterator<Integer> iterator = compose(Collections.singletonList(iter(new Integer[]{})));
     int cnt = 0;
     while (iterator.hasNext()) {
       iterator.next();
@@ -159,8 +156,8 @@ public class SequenceIteratorTest extends TestCase {
   }
 
   public void testRemoveOnlyOne() {
-    final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1));
-    final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator()));
+    final ArrayList<Integer> list1 = new ArrayList<>(Collections.singletonList(1));
+    final Iterator<Integer> iterator = compose(Collections.singletonList(list1.iterator()));
     iterator.next();
     iterator.remove();
     assertTrue(list1.isEmpty());
@@ -180,8 +177,8 @@ public class SequenceIteratorTest extends TestCase {
   }
 
   public void testRemoveIfNextNotCalled() {
-    final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1));
-    final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator()));
+    final ArrayList<Integer> list1 = new ArrayList<>(Collections.singletonList(1));
+    final Iterator<Integer> iterator = compose(Collections.singletonList(list1.iterator()));
     try {
       iterator.remove();
       fail();
@@ -193,7 +190,7 @@ public class SequenceIteratorTest extends TestCase {
 
   public void testRemoveTwice() {
     final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5));
-    final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator()));
+    final Iterator<Integer> iterator = compose(Collections.singletonList(list1.iterator()));
     try {
       iterator.next();
       iterator.remove();
@@ -223,11 +220,12 @@ public class SequenceIteratorTest extends TestCase {
 
   public void testRemoveAllWithEmptyInside() {
     final ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1, 2));
+    @SuppressWarnings("MismatchedQueryAndUpdateOfCollection") 
     final ArrayList<Integer> list2 = new ArrayList<>();
     final ArrayList<Integer> list3 = new ArrayList<>(Arrays.asList(5, 6));
 
-    final Iterator<Integer> iterator =
-      compose(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()));
+    @SuppressWarnings("RedundantOperationOnEmptyContainer") 
+    final Iterator<Integer> iterator = compose(Arrays.asList(list1.iterator(), list2.iterator(), list3.iterator()));
     while (iterator.hasNext()) {
       iterator.next();
       iterator.remove();
index 8511ee4bd066866dfa129b4a061f35a8beaa3db4..2c6fafb5ccc09c3c0de190883b684f4ae674dd2d 100644 (file)
@@ -41,11 +41,11 @@ public class ArraysAsListWithZeroOrOneArgumentFixTest extends IGQuickFixesTestCa
     doTest(InspectionGadgetsBundle.message("arrays.as.list.with.zero.arguments.quickfix"),
            "import java.util.*;\n" +
            "class X {{\n" +
-           "    Iterator<String> it = Arrays.<String>/**/asList().iterator();\n" +
+           "    Spliterator<String> it = Arrays.<String>/**/asList().spliterator();\n" +
            "}}",
            "import java.util.*;\n" +
            "class X {{\n" +
-           "    Iterator<String> it = Collections.<String>emptyList().iterator();\n" +
+           "    Spliterator<String> it = Collections.<String>emptyList().spliterator();\n" +
            "}}");
   }
 
index 484aad25f966b0f28819b0bbc5576dd763409ecf..4ff19ace100257c43a9a89ce331e582eb0350bd1 100644 (file)
@@ -88,8 +88,8 @@ public abstract class AntDomElement implements DomElement {
 
   public final Iterator<AntDomElement> getAntChildrenIterator() {
     final List<DomElement> children = DomUtil.getDefinedChildren(this, true, false);
-    if (children.size() == 0) {
-      return Collections.<AntDomElement>emptyList().iterator();
+    if (children.isEmpty()) {
+      return Collections.emptyIterator();
     }
     final Iterator<DomElement> it = children.iterator();
     return new Iterator<AntDomElement>() {
@@ -132,11 +132,11 @@ public abstract class AntDomElement implements DomElement {
   }
 
   public final boolean isTask() {
-    return Role.TASK.equals(getChildDescription().getUserData(ROLE));
+    return Role.TASK == getChildDescription().getUserData(ROLE);
   }
 
   public final boolean isDataType() {
-    return Role.DATA_TYPE.equals(getChildDescription().getUserData(ROLE));
+    return Role.DATA_TYPE == getChildDescription().getUserData(ROLE);
   }
 
   public String toString() {
@@ -145,7 +145,7 @@ public abstract class AntDomElement implements DomElement {
       return super.toString();
     }
     final String name = tag.getName();
-    if ("".equals(name)) {
+    if (name.isEmpty()) {
       return super.toString();
     }
     return name;
index 7cfd7e5dc966f0a4c4268e0eee0c4469e3df0152..6b4b609669e91fcb208397145439af37892afa8c 100644 (file)
@@ -101,8 +101,8 @@ public class AntDomExtender extends DomExtender<AntDomElement>{
 
       final DomGenericInfo genericInfo = antDomElement.getGenericInfo();
       AntIntrospector classBasedIntrospector = null;
-      final Hashtable<String,Class> coreTaskDefs = reflected.getTaskDefinitions();
-      final Hashtable<String, Class> coreTypeDefs = reflected.getDataTypeDefinitions();
+      final Map<String,Class> coreTaskDefs = reflected.getTaskDefinitions();
+      final Map<String, Class> coreTypeDefs = reflected.getDataTypeDefinitions();
       final boolean isCustom = antDomElement instanceof AntDomCustomElement;
       if ("project".equals(tagName)) {
         classBasedIntrospector = getIntrospector(reflected.getProject().getClass());
@@ -187,7 +187,6 @@ public class AntDomExtender extends DomExtender<AntDomElement>{
               }
             }
           }
-          registrar.registerCustomChildrenExtension(AntDomCustomElement.class, new AntCustomTagNameDescriptor());
         }
         else {
           final Iterator<String> nested = parentIntrospector.getNestedElementsIterator();
@@ -208,19 +207,15 @@ public class AntDomExtender extends DomExtender<AntDomElement>{
                 extension.putUserData(ELEMENT_IMPL_CLASS_KEY, type);
               }
               AntDomElement.Role role = AntDomElement.Role.DATA_TYPE;
-              if (coreTaskDefs != null && coreTaskDefs.containsKey(nestedElementName)) {
+              if (coreTaskDefs != null && coreTaskDefs.containsKey(nestedElementName) ||
+                  type != null && isAssignableFrom(Task.class.getName(), type)) {
                 role = AntDomElement.Role.TASK;
               }
-              else if (type != null && isAssignableFrom(Task.class.getName(), type)) {
-                role = AntDomElement.Role.TASK;
-              }
-              if (role != null) {
-                extension.putUserData(AntDomElement.ROLE, role);
-              }
+              extension.putUserData(AntDomElement.ROLE, role);
             }
           }
-          registrar.registerCustomChildrenExtension(AntDomCustomElement.class, new AntCustomTagNameDescriptor());
         }
+        registrar.registerCustomChildrenExtension(AntDomCustomElement.class, new AntCustomTagNameDescriptor());
       }
     }
   }
@@ -340,7 +335,7 @@ public class AntDomExtender extends DomExtender<AntDomElement>{
     try {
       final ClassLoader loader = clazz.getClassLoader();
       if (loader != null) {
-        final Class baseClass = loader.loadClass(baseClassName);
+        final Class<?> baseClass = loader.loadClass(baseClassName);
         return baseClass.isAssignableFrom(clazz);
       }
     }
@@ -420,12 +415,12 @@ public class AntDomExtender extends DomExtender<AntDomElement>{
   private static abstract class AbstractIntrospector {
     @NotNull
     public Iterator<String> getAttributesIterator() {
-      return Collections.<String>emptyList().iterator();
+      return Collections.emptyIterator();
     }
 
     @NotNull
     public Iterator<String> getNestedElementsIterator(){
-      return Collections.<String>emptyList().iterator();
+      return Collections.emptyIterator();
     }
 
     public abstract boolean isContainer();
@@ -531,8 +526,8 @@ public class AntDomExtender extends DomExtender<AntDomElement>{
     @NotNull
     public Iterator<String> getAttributesIterator() {
       final List<AntDomMacrodefAttribute> macrodefAttributes = myMacrodef.getMacroAttributes();
-      if (macrodefAttributes.size() == 0) {
-        return Collections.<String>emptyList().iterator();
+      if (macrodefAttributes.isEmpty()) {
+        return Collections.emptyIterator();
       }
       final List<String> attribs = new ArrayList<>(macrodefAttributes.size());
       for (AntDomMacrodefAttribute attribute : macrodefAttributes) {
index ef1d24cbe1ae2d53f3409e89f6c17c2fa4a1974f..ff7eaea7e8df1e176c1f4d065feaf7babd2137e4 100644 (file)
@@ -29,8 +29,6 @@ import com.intellij.psi.xml.*;
 import com.intellij.xml.XmlAttributeDescriptor;
 import org.intellij.plugins.xpathView.util.MyPsiUtil;
 import org.jaxen.DefaultNavigator;
-import org.jaxen.FunctionCallException;
-import org.jaxen.UnsupportedAxisException;
 import org.jaxen.XPath;
 import org.jaxen.saxpath.SAXPathException;
 import org.jetbrains.annotations.NotNull;
@@ -52,9 +50,9 @@ public class PsiDocumentNavigator extends DefaultNavigator {
     }
 
     @Override
-    public Iterator getChildAxisIterator(Object contextNode) throws UnsupportedAxisException {
+    public Iterator getChildAxisIterator(Object contextNode) {
         if (!(contextNode instanceof XmlElement)) {
-            return Collections.emptyList().iterator();
+            return Collections.emptyIterator();
         }
         return new PsiChildAxisIterator(contextNode);
     }
@@ -63,7 +61,7 @@ public class PsiDocumentNavigator extends DefaultNavigator {
     @Override
     public Iterator getParentAxisIterator(Object contextNode) {
         if (!(contextNode instanceof XmlElement)) {
-            return Collections.emptyList().iterator();
+            return Collections.emptyIterator();
         }
 
         return new NodeIterator((XmlElement)contextNode) {
@@ -147,12 +145,12 @@ public class PsiDocumentNavigator extends DefaultNavigator {
     }
 
     @Override
-    public Object getParentNode(Object contextNode) throws UnsupportedAxisException {
+    public Object getParentNode(Object contextNode) {
         return ((PsiElement)contextNode).getParent();
     }
 
     @Override
-    public Object getDocument(String url) throws FunctionCallException {
+    public Object getDocument(String url) {
         final VirtualFile virtualFile = VfsUtilCore.findRelativeFile(url, file.getVirtualFile());
         if (virtualFile != null) {
             final PsiFile file = this.file.getManager().findFile(virtualFile);
@@ -168,7 +166,7 @@ public class PsiDocumentNavigator extends DefaultNavigator {
         if (isElement(contextNode)) {
             return new AttributeIterator((XmlElement)contextNode);
         } else {
-            return Collections.emptyList().iterator();
+            return Collections.emptyIterator();
         }
     }