Provide equals/hashCode based on original PSI to avoid potential PCEs

#KT-59445
This commit is contained in:
Vladimir Dolzhenko
2023-06-20 13:31:15 +02:00
committed by Space Team
parent 05652e7d8d
commit d0477a6a30
2 changed files with 15 additions and 0 deletions
@@ -18,6 +18,12 @@ class JavaElementPsiSourceWithFixedPsi<PSI : PsiElement>(
override val factory: JavaElementSourceFactory
get() = JavaElementSourceFactory.getInstance(psi.project)
override fun equals(other: Any?): Boolean {
return if (other === this) true else other is JavaElementPsiSourceWithFixedPsi<*> && psi == other.psi
}
override fun hashCode(): Int = psi.hashCode()
override fun toString(): String {
return psi.toString()
}