I just put in a bunch of work to convert some code...
# reflect
g
I just put in a bunch of work to convert some code to kotlin from java, and it looks like ill have to convert it back unless i can figure out how to get
::invoke
off a
KClass
instance
c
I expect the KClass is added by the Kotlin compiler to "make it work" on the JVM, as
fun
is not part of a class, right? Why would you need invoke on the class?
k
You can create a
java.util.function.Function
from a
KFunction
just by the expression
Function(x)
. Then you'll have the
apply
method available.
g
I've got an (existing, legacy) annotation based system im trying to update. there are a couple (thanifully fairly few, so I can simply update these) call sites like this:
Copy code
annotationThing.process(arg = @CustomAnnotation fun(message: Message) { ... })
annotationThing.process
in turn calls
arg::class.members.findMembersAnnotatedBy<CustomAnnotation>
as it is that system cant find the
invoke
fun. This seems like a bug to me.
c
what's the implentation of
process
?