Skip to content

Using top-level wildcard for kotlin_package_mapping should not rewrite well-known type package #286

@darronschall

Description

@darronschall

If I use the kotlin_package_mapping feature with a top-level wildcard (to move all of the proto packages underneath my own top-level package), like this:

kotlin_package_mapping="*->com.exampleapp.api.*"

The generated code will convert well-known-types incorrectly. That is, it converts google.protobuf.Timestamp to com.exampleapp.api.pbandk.wkt.Timestamp. The results in a compiler error; the pbandk.wkt.Timestamp is provided by the PBandK library itself and not available at the mapped package.

The workaround is to preserve the well-known-type package mapping, like this:

kotlin_package_mapping="google.protobuf->pbandk.wkt;*->com.exampleapp.api.*"

At first I thought this was a bug, but considering I did ask every package to be rewritten to a new top-level package, maybe it's working as designed? I figured I'd log it just in case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions