Closed garyp closed 2 years ago
How come only
Sequence
needed special treatment though?
We already have special support for other common Kotlin types here:
Basically, if you have a protobuf type named something like Long
, pbandk will name the generated Kotlin class Long_
instead. I considered just adding Sequence
to that list, so that it also gets transformed into Sequence_
. But I think trying to add every single class from the Kotlin standard library to the disallowed names list is a losing battle. Plus as Kotlin adds new classes to the stdlib, it has the potential to break pbandk-generated classes that were previously working.
So instead I think it's better to ensure that the generated code is always using fully-qualified class names to avoid generated class names from clashing with the Kotlin stdlib. I didn't want to break existing code with this PR, but in a future change I'd like to remove the existing entries from disallowedTypeNames
and instead use fully-qualified class names like I'm doing for Sequence
in this PR. That's a low priority for now, but I didn't want to dig a deeper hole by adding Sequence
to disallowedTypeNames
.
Fixes #237