Konsist: implement another workaround.

This commit is contained in:
Benoit Marty
2024-09-27 12:14:51 +02:00
parent 5f27c3ccc3
commit 46b41ea363

View File

@@ -74,7 +74,14 @@ class KonsistClassNameTest {
.replace("FakeRust", "")
.replace("Fake", "")
(it.name.startsWith("Fake") || it.name.startsWith("FakeRust")) &&
it.parents().any { parent -> parent.name.replace(".", "") == interfaceName }
it.parents().any { parent ->
// Workaround to get the parent name. For instance:
// parent.name used to return `UserListPresenter.Factory` but is now returning `Factory`.
// So we need to retrieve the name of the parent class differently.
val packageName = parent.packagee!!.name
val parentName = parent.fullyQualifiedName!!.substringAfter("$packageName.").replace(".", "")
parentName == interfaceName
}
}
}