How to use FunSpec.overriding? in KotlinPoet
问题 Submitted by Fleshgrinder on GitHub. The FunSpec class has the very handy overriding method, however, it is unclear how this can be used while generating code. Minimal example: FileSpec.builder("com.fleshgrinder", "KotlinPoet").apply { val className = ClassName("com.fleshgrinder", "KotlinPoet") addType(TypeSpec.classBuilder(className).apply { addFunction(FunSpec.builder("toString").apply { addModifiers(KModifier.OVERRIDE) addStatement("""return "KotlinPoet"""") }.build()) }.build()) }.build()