in intellij-plugin-verifier/verifier-core/src/main/java/com/jetbrains/pluginverifier/results/presentation/HierarchicalProblemsDescription.kt [28:64]
fun presentableElementMightHaveBeenDeclaredInSuperTypes(
elementType: String,
ownerHierarchy: ClassHierarchy,
canBeDeclaredInSuperClass: Boolean,
canBeDeclaredInSuperInterface: Boolean
): String {
val (allSuperClasses, allSuperInterfaces) = findCandidateSuperClassesAndInterfaces(ownerHierarchy)
val superClasses = if (canBeDeclaredInSuperClass) allSuperClasses else emptySet()
val superInterfaces = if (canBeDeclaredInSuperInterface) allSuperInterfaces else emptySet()
return if (superClasses.isEmpty() && superInterfaces.isEmpty()) {
""
} else buildString {
append("The $elementType might have been declared ")
if (superClasses.isNotEmpty()) {
append("in the super " + "class".pluralize(superClasses.size))
}
if (superInterfaces.isNotEmpty()) {
if (superClasses.isNotEmpty()) {
append(" or ")
}
append("in the super " + "interface".pluralize(superInterfaces.size))
}
append(":")
val superTypes = superClasses.map(toFullJavaClassName).sorted() + superInterfaces.map(toFullJavaClassName).sorted()
if (superTypes.size <= 2) {
append(" ")
append(superTypes.joinToString())
} else {
for (superType in superTypes) {
appendLine()
append(" $superType")
}
}
}
}