Looking at the KotlinPoet documentation <https://s...
# squarelibraries
s
Looking at the KotlinPoet documentation https://square.github.io/kotlinpoet/ I can’t seem to find how one would generate a function with a generic argument with an upper bound to some type, something like:
Copy code
fun <T : SomeType> foo(param: Bar<T>): Unit {
  asdf(myParam)
}
Is there some part of the docs which I am missing? If so I’d really appreciate any pointers.
m
Maybe this and this helps.
s
Yes!! I was trying to do this inside the
addParameter(ClassName(...).parameterizedBy(//here))
and I completely missed the
addTypeVariables
function. This is the first time I use KotlinPoet so I am not familiar with the entire API and the mental model of how everything should be hooked up. Thanks a ton for this! I will however still file a bug in the repository to hopefully expand the docs a bit on this, I feel like it does deserve a spot in the samples given in https://square.github.io/kotlinpoet/
m
Maybe file a PR instead with a good example. I think the maintainers are open to that and issue is resolved right away.
s
That is true, good idea! I will give it a try as soon as possible.