Implement KtLightTypeParameter.isEquivalentTo() without referencing delegate (this is faster and more correct)

This commit is contained in:
Dmitry Jemerov
2016-11-22 14:49:18 +01:00
parent 956e1c70dc
commit 763782083c
@@ -160,4 +160,16 @@ public class KtLightTypeParameter
if (obj == this) return true;
return obj instanceof KtLightTypeParameter && getKotlinOrigin().equals(((KtLightTypeParameter) obj).getKotlinOrigin());
}
@Override
public boolean isEquivalentTo(PsiElement another) {
if (another instanceof PsiTypeParameter) {
PsiTypeParameter anotherTypeParameter = (PsiTypeParameter) another;
PsiTypeParameterListOwner owner = getOwner();
if (owner != null) {
return owner.isEquivalentTo(anotherTypeParameter.getOwner()) && getIndex() == anotherTypeParameter.getIndex();
}
}
return false;
}
}