It seems that Kotlin does not support getting local functions etc. Please see the example below:
fun <T> MutableList<T>.filterOnCondition(condition: (T) -> Boolean): MutableList<T> { // For the printline, trying to get the function name, // which in this case is passedAsCondition println(condition.reflect()!!.instanceParameter!!.name) } fun passedAsCondition (number: Int, multipleOf : Int): Boolean { return number % multipleOf == 0 } numbers.filterOnCondition { passedAsCondition(it, 5) } Kotlin returns this error as it has not been mapped out yet:
"kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Introspecting local functions, lambdas, anonymous functions and local variables is not yet fully supported in Kotlin reflection"
BUT, surely this is possible to do via Java, is it not?
Arrays.asList(5, 6, 10, 13, 15, 24).stream().filter(x -> x % 5 == 0).forEachOrdered(System.out::println);- not sure what you're asking... something about passing a function to filter?passedAsConditionis in the lambda body.