reduce PsiReference#isSoft invocations
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Wed, 29 Jun 2016 14:24:31 +0000 (17:24 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Wed, 29 Jun 2016 14:24:31 +0000 (17:24 +0300)
platform/core-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/PsiMultiReference.java

index 2d93eb27f10ad0ca37841dfa563caa8d84f73fea..dd4f369e4f94787c4045c9e43bdfa79998f5f95e 100644 (file)
@@ -38,8 +38,9 @@ public class PsiMultiReference implements PsiPolyVariantReference {
   public static final Comparator<PsiReference> COMPARATOR = new Comparator<PsiReference>() {
     @Override
     public int compare(final PsiReference ref1, final PsiReference ref2) {
-      if (ref1.isSoft() && !ref2.isSoft()) return 1;
-      if (!ref1.isSoft() && ref2.isSoft()) return -1;
+      boolean soft1 = ref1.isSoft();
+      boolean soft2 = ref2.isSoft();
+      if (soft1 ^ soft2) return soft1 ? 1 : -1;
 
       boolean resolves1 = resolves(ref1);
       boolean resolves2 = resolves(ref2);