abstract val elementsCount: Int

The number of elements this descriptor describes, besides from the class itself. elementsCount describes the number of semantic elements, not the number of actual fields/properties in the serialized form, even though they frequently match.

For example, for the following class class Complex(val real: Long, val imaginary: Long) the corresponding descriptor and the serialized form both have two elements, while for class IntList : ArrayList<Int>() the corresponding descriptor has a single element (IntDescriptor, the type of list element), but from zero up to Int.MAX_VALUE values in the serialized form.