You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing a library that has multiple annotation processors and also uses KotlinPoet (thank's for the awesome work!). However, I am stuck on a very specific issue due to a new language feature which is essential for this library.
Kotlin 1.6.20 added context receivers. I currently need to declare a property that has multiple implicit receivers. It seems this will require an update to KotlinPoet.
These waiting could be avoided if there was a way to add a custom block at file spec level something like:
FileSpec
.builder(packageName, fileName)
.addCode("context(TypeA, TypeB)") // As a workaround
.addProperty(propertySpec)
.build()
Is there a way to achieve this that I am not aware of?
Thanks in advance
The text was updated successfully, but these errors were encountered:
Context receivers were tracked by #1232 and support is merged. Arbitrary code addition isn't an appealing feature here because we do not guarantee the order that you add items to a spec builder is the output order.
@JakeWharton Thanks for the feedback! Arbitrary code addition doesn't indeed sound appealing under those circumstances. I'll move on to a snapshot version until it's officially released.
Hello,
I am writing a library that has multiple annotation processors and also uses KotlinPoet (thank's for the awesome work!). However, I am stuck on a very specific issue due to a new language feature which is essential for this library.
Is there a way to achieve this that I am not aware of?
Thanks in advance
The text was updated successfully, but these errors were encountered: