Implement equals/hashCode as this class previously was a data one
Fixes duplicated diagnostics in tests
This commit is contained in:
@@ -47,6 +47,24 @@ internal sealed class DeprecatedByAnnotation(
|
|||||||
"HIDDEN" -> HIDDEN
|
"HIDDEN" -> HIDDEN
|
||||||
else -> WARNING
|
else -> WARNING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other !is StandardDeprecated) return false
|
||||||
|
|
||||||
|
if (annotation != other.annotation) return false
|
||||||
|
if (target != other.target) return false
|
||||||
|
if (propagatesToOverrides != other.propagatesToOverrides) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var hash = annotation.hashCode()
|
||||||
|
hash = hash * 31 + target.hashCode()
|
||||||
|
hash = hash * 31 + propagatesToOverrides.hashCode()
|
||||||
|
return hash
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DeprecatedSince(
|
class DeprecatedSince(
|
||||||
@@ -54,7 +72,27 @@ internal sealed class DeprecatedByAnnotation(
|
|||||||
target: DeclarationDescriptor,
|
target: DeclarationDescriptor,
|
||||||
propagatesToOverrides: Boolean,
|
propagatesToOverrides: Boolean,
|
||||||
override val deprecationLevel: DeprecationLevelValue
|
override val deprecationLevel: DeprecationLevelValue
|
||||||
) : DeprecatedByAnnotation(annotation, target, propagatesToOverrides)
|
) : DeprecatedByAnnotation(annotation, target, propagatesToOverrides) {
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other !is DeprecatedSince) return false
|
||||||
|
|
||||||
|
if (annotation != other.annotation) return false
|
||||||
|
if (target != other.target) return false
|
||||||
|
if (propagatesToOverrides != other.propagatesToOverrides) return false
|
||||||
|
if (deprecationLevel != other.deprecationLevel) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var hash = annotation.hashCode()
|
||||||
|
hash = hash * 31 + target.hashCode()
|
||||||
|
hash = hash * 31 + propagatesToOverrides.hashCode()
|
||||||
|
hash = hash * 31 + deprecationLevel.hashCode()
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun create(
|
fun create(
|
||||||
|
|||||||
Reference in New Issue
Block a user