Closed simonsickle closed 1 week ago
The _
is adding by KotlinPoet which does so because value
can be a keyword depending on its usage.
If you want backtick instead, you can use escapeKotlinKeywords = true
in the kotlin {}
block like so
wire {
kotlin {
escapeKotlinKeywords = true
}
}
Since it isn't a keyword in this scenario, escaping doesn't seem like the correct behavior to me (and the conventions plugin here won't let me configure wire as far as I can tell, no one internally seems to be using escapeKotlinKeywords
).
That said, this issue is in the KotlinPoet project, not Wire.
Further context for the next person, https://github.com/square/kotlinpoet/pull/994
This seems to be expected behavior to avoid having to write all of the compiler rules into KotlinPoet
Context
I have a simple proto file that is essentially representing a map with a
name
andvalue
field.I expect the generated Kotlin code to look something like
Actual
The generated Kotlin code is generated with an underscore appended to the end of the
value
property name.Expected
I expect
value
to not contain an underscore since it is not a keyword as a property name.