Tianyu Zhu
10/07/2021, 4:03 PMKirill Grouchnikov
10/07/2021, 4:14 PMTianyu Zhu
10/07/2021, 4:17 PMUtil.kt
with
fun foo() { ... }
fun bar() { ... }
In Java you'd be able to access these by writing
UtilKt.foo()
And you'd also be able to get the class:
UtilKt.class
Can I do the same in Kotlin?Tianyu Zhu
10/07/2021, 4:21 PMJoffrey
10/07/2021, 4:35 PMTianyu Zhu
10/07/2021, 4:40 PMUtilKt.class
reflectively, e.g.
UtilKt::class.declaredFunctions
Scott Kruse
10/07/2021, 4:41 PMephemient
10/07/2021, 4:49 PMClass.forName("UtilKt").kotlin.declaredFunctions
will work, as "UtilKt" is not a Kotlin class, it is a Kotlin file facade classephemient
10/07/2021, 4:51 PMTianyu Zhu
10/07/2021, 4:54 PM