memory optimization
authorAlexey Kudravtsev <cdr@intellij.com>
Mon, 28 Jun 2010 14:06:57 +0000 (18:06 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Wed, 30 Jun 2010 10:14:04 +0000 (14:14 +0400)
platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/ReferenceProvidersRegistry.java

index 0640c86849d7a4e6b5d549e21b38599c81a39726..8ae866c773b8ff1b3601507a7fec76708f424935 100644 (file)
@@ -82,7 +82,7 @@ public class ReferenceProvidersRegistry extends PsiReferenceRegistrar {
     };
   private final Project myProject;
 
-  private final static NotNullLazyKey<ReferenceProvidersRegistry, Project> INSTANCE_CACHE =
+  private static final NotNullLazyKey<ReferenceProvidersRegistry, Project> INSTANCE_CACHE =
     ServiceManager.createLazyKey(ReferenceProvidersRegistry.class);
 
   public static ReferenceProvidersRegistry getInstance(Project project) {
@@ -267,7 +267,6 @@ public class ReferenceProvidersRegistry extends PsiReferenceRegistrar {
         }
       }
     }
-    return ContainerUtil.toArray(result, new PsiReference[result.size()]);
+    return result.isEmpty() ? PsiReference.EMPTY_ARRAY : ContainerUtil.toArray(result, new PsiReference[result.size()]);
   }
-
 }