diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt index 0c0f5efe08..9d8b15bc5a 100644 --- a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt @@ -1053,16 +1053,15 @@ sealed class ExecutableId : StatementId() { return "$name($args)$retType" } + fun describesSameMethodAs(other: ExecutableId): Boolean { + return classId == other.classId && signature == other.signature + } + override fun equals(other: Any?): Boolean { if (this === other) return true if (javaClass != other?.javaClass) return false - other as ExecutableId - - if (classId != other.classId) return false - if (signature != other.signature) return false - - return true + return describesSameMethodAs(other as ExecutableId) } override fun hashCode(): Int { diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/util/ClassIdUtil.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/util/ClassIdUtil.kt index a215965853..8db657ff60 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/util/ClassIdUtil.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/util/ClassIdUtil.kt @@ -37,10 +37,10 @@ infix fun ClassId.isAccessibleFrom(packageName: String): Boolean { * Returns field of [this], such that [methodId] is a getter for it (or null if methodId doesn't represent a getter) */ internal fun ClassId.fieldThatIsGotWith(methodId: MethodId): FieldId? = - allDeclaredFieldIds.singleOrNull { !it.isStatic && it.getter == methodId } + allDeclaredFieldIds.singleOrNull { !it.isStatic && it.getter.describesSameMethodAs(methodId) } /** * Returns field of [this], such that [methodId] is a setter for it (or null if methodId doesn't represent a setter) */ internal fun ClassId.fieldThatIsSetWith(methodId: MethodId): FieldId? = - allDeclaredFieldIds.singleOrNull { !it.isStatic && it.setter == methodId } \ No newline at end of file + allDeclaredFieldIds.singleOrNull { !it.isStatic && it.setter.describesSameMethodAs(methodId) } \ No newline at end of file