I'm using KotlinPoet for annotation processing, but I've got an issue. I need return function in generated class, but I'm not sure that KotlinPoet can do it? If you have some experience, please help me.
That I can do:
fun test(): String = ...
That I need to do
fun test(): () -> String = ...
Similar to ClassName
or TypeName
, you can use LambdaTypeName
to create a function type with no parameters and String
return type:
val type = LambdaTypeName.get(returnType = String::class.asTypeName())