From 92f92ffa65407c07f6b51513f774ee178c7780ee Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 11 Apr 2012 18:40:50 +0400 Subject: [PATCH] performance --- .../psi/impl/smartPointers/AnchorElementInfo.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java b/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java index 5a42279609a8..e8daf7b482b8 100644 --- a/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java +++ b/java/java-impl/src/com/intellij/psi/impl/smartPointers/AnchorElementInfo.java @@ -16,7 +16,6 @@ package com.intellij.psi.impl.smartPointers; import com.intellij.openapi.editor.RangeMarker; -import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.ProperTextRange; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; @@ -90,12 +89,11 @@ class AnchorElementInfo extends SelfElementInfo { @Override public boolean pointsToTheSameElementAs(@NotNull SmartPointerElementInfo other) { if (other instanceof AnchorElementInfo) { - return super.pointsToTheSameElementAs(other) && - stubId == ((AnchorElementInfo)other).stubId && - myStubElementType == ((AnchorElementInfo)other).myStubElementType; + AnchorElementInfo otherAnchor = (AnchorElementInfo)other; + if (stubId != -1 && otherAnchor.stubId != -1 && stubId != otherAnchor.stubId) return false; + if (myStubElementType != null && otherAnchor.myStubElementType != null && myStubElementType != otherAnchor.myStubElementType) return false; } - - return Comparing.equal(restoreElement(), other.restoreElement()); + return super.pointsToTheSameElementAs(other); } @Override