We need better Kotlin API doc on String class?


fun main(args : Array<String>) {   val s : Any = "abc"   println(s is String)   println(s is jet.String)   println(s is java.lang.String)   println(s is CharSequence)   println(s is Iterable<*>) }

The above all show true except the “Iterable”. Shouldn’t the kotlin API doc somehow display the String class hierachy with these membership in them?

Also would it make sense to make “Iterable” return true for String since it works in a for loop?

Another suggestion on improving kotlin API doc is I don’t see proper link to “jet” package, and yet other classes in API doc reference them in many places (sometimes the link is broken when viewing “jet.Any” for example). I don’t mean just the “Extension” under “kotlin” package, I would like to see actual “jet.String” class itself for example. I think these might be helpful to users.


To make some class available for iterating in loop, we don't require it to implement Iterable interface, we require only existence of "iterator" function, which can be extension function. Therefore String is not a subclass of Iterable. jet.String is a type which doesn't exist in runtime: it is mapped to java.lang.String: as values and in is-checks. Several other Kotlin classes are mapped to particular Java classes, as well. It's a good idea to document it, thanks for pointing out: KT-3205.

Also, I have added request about missing ‘jet’ package in API docs: KT-3206.