kotlincode-generationkotlinpoet

Kotlinpoet: Ommitting redundant `public` modifier from generated types and properties


Is there any way to omit the redundant public modifier from types and properties generated via KotlinPoet's TypeSpec.Builder and PropertySpec.Builder respectively?


Solution

  • No, and no plans to support such functionality. If it's important for your use case to not have explicit public modifiers, a good solution would be to post-process the output with a script that removes them.