Background: I have an annotation processor that builds retrofit interfaces by scanning spring annotations on controllers. I have it set up to work in either kotlin or java based spring applications, and it can generate either kotlin or java retrofit client interfaces.
Question: When running it against a kotlin based spring application, is there a way to pick up a default value on a controller function, whether reflectively or through some other means?
e.g. the controller function looks something like
@RequestMapping("/foo")
fun getSomething(@RequestParameter foo: String = "bar") {
...
}
and I want to be able to generate a retrofit interface method that looks something like
fun getSomething(@Header foo: String = "bar")
I am aware that the compiler under the hood actually creates multiple override methods for the jvm: https://discuss.kotlinlang.org/t/retrieve-default-parameter-value-via-reflection/7314
But I'm wondering if there's a way to capture these defaults during the annotation processing phase or if I just have to live without defaults in the generated kotlin client.
Long story short - is there a workaround that would let me capture these defaults?