Kapt: Do not use PsiType comparison in equals() where possible
(cherry picked from commit 89ba634)
This commit is contained in:
committed by
Yan Zhulanow
parent
18068c699d
commit
cacec67044
+2
-2
@@ -32,8 +32,8 @@ class JeArrayType(override val psiType: PsiArrayType, override val psiManager: P
|
||||
override fun equals(other: Any?): Boolean{
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
return psiType == (other as? JeArrayType)?.psiType
|
||||
return componentType == (other as? JeArrayType)?.componentType
|
||||
}
|
||||
|
||||
override fun hashCode() = psiType.hashCode()
|
||||
override fun hashCode() = componentType.hashCode()
|
||||
}
|
||||
+2
-1
@@ -45,7 +45,8 @@ class JeClassInitializerExecutableTypeMirror(val initializer: PsiClassInitialize
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
return initializer == (other as JeClassInitializerExecutableTypeMirror).initializer
|
||||
other as? JeClassInitializerExecutableTypeMirror ?: return false
|
||||
return initializer == other.initializer
|
||||
}
|
||||
|
||||
override fun hashCode() = initializer.hashCode()
|
||||
|
||||
+13
-4
@@ -80,13 +80,22 @@ class JeDeclaredType(
|
||||
return PsiTypesUtil.getClassType(psiClass).toJeType(psiManager)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean{
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
return psiType == (other as? JeDeclaredType)?.psiType
|
||||
other as? JeDeclaredType ?: return false
|
||||
|
||||
return enclosingType == other.enclosingType
|
||||
&& psiClass == other.psiClass
|
||||
&& typeArguments == other.typeArguments
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = enclosingType.hashCode()
|
||||
result = 31 * result + psiClass.hashCode()
|
||||
result = 31 * result + typeArguments.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun hashCode() = psiType.hashCode()
|
||||
|
||||
override fun toString() = psiType.getCanonicalText(false)
|
||||
}
|
||||
+3
-3
@@ -31,11 +31,11 @@ class JeIntersectionType(
|
||||
|
||||
override fun getBounds() = psiType.superTypes.map { it.toJeType(psiManager) }
|
||||
|
||||
override fun equals(other: Any?): Boolean{
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
return psiType == (other as? JeIntersectionType)?.psiType
|
||||
return bounds == (other as? JeIntersectionType)?.bounds
|
||||
}
|
||||
|
||||
override fun hashCode() = psiType.hashCode()
|
||||
override fun hashCode() = bounds.hashCode()
|
||||
}
|
||||
+1
-1
@@ -71,7 +71,7 @@ class JeMethodExecutableTypeMirror(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other?.javaClass != javaClass) return false
|
||||
return psi == (other as JeMethodExecutableTypeMirror).psi
|
||||
return psi == (other as? JeMethodExecutableTypeMirror)?.psi
|
||||
}
|
||||
|
||||
override fun hashCode() = psi.hashCode()
|
||||
|
||||
Reference in New Issue
Block a user