https://kotlinlang.org logo
Title
d

Draget

12/05/2021, 8:41 PM
If I define a function outside a class and want to access it with reflection, under which 'class' do I find it?
t

TwoClocks

12/05/2021, 9:02 PM
I think it's just a static function in a anomalous class someplace.
it's not associated w/ the class it's extending, at least not from a reflection POV
I think you'd have to search all static function that take the class you extended as the first param.
although, I'm not 100% sure about that.
e

ephemient

12/05/2021, 10:29 PM
unless overridden with
@file:JvmName
, top-level functions and properties are compiled into a class named after the filename plus "kt", see https://kotlinlang.org/docs/java-to-kotlin-interop.html#package-level-functions