Use kind when descriptor.id != descriptor.clazz.name and $clazz otherwise. (cherry picked from commit 901194ae)