The first is generally impossible by normal means, since the Java reflection API doesn't provide any way to search for all classes available via the class loader. So any solution here would be an enormous hack :)
The second is more complicated. Basically it's still impossible for the reason that a package name doesn't identify names of the classes in that package which the Kotlin reflection needs. However, if you'd also give the name of the
module, Kotlin reflection would be able to look into the corresponding
.kotlin_module
file (provided that it hasn't been stripped in the build process, the possibility of which is by the way investigated right now by the Android team, see
https://youtrack.jetbrains.com/issue/KT-30344), fetch the class names from there and load all the extensions. We've discussed this feature a few years ago but never had the chance to implement it, and there were no external requests AFAIK, so it's still not implemented.