https://kotlinlang.org logo
Title
d

Davio

11/24/2018, 7:15 AM
But I'm stuck on the Processor how to add something to the existing method
i

igor.wojda

11/24/2018, 9:03 AM
I am not 100% sure but as I recall preprocessor should not modify existing code. Tools like mockito/autovalue generate subclass, override method do some additional operation there and call super method
d

Davio

11/24/2018, 10:16 AM
I ended up solving it in a different way, without annotation, I created a custom function
fun myFun(function: () -> Any) { .. }
and just wrapped the method bodies inside it
So inside myFun I call function.invoke() where I want
p

pankajrai

11/25/2018, 12:07 PM
Yep, that's an easy way with higher order function and inside higher order function have invoke method inside measureTimeInMillis and inline this higher order function.