Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #104 from v0.9.x branch #115

Merged
merged 1 commit into from
Dec 28, 2020
Merged

Conversation

garyp
Copy link
Collaborator

@garyp garyp commented Dec 28, 2020

No description provided.

Fixes #47

For the following protobuf where the `oneof` field had the same name as message, the companion object definition would shadow the `oneof` class instead of the `message` class. This patch fixes it by fully qualifying the `message` class name.

**Input:**

```protobuf
syntax = "proto3";
package foobar;

message Value {
    oneof value {
        int32 int_val = 1;
        string str_val = 2;
    }
}
```

**Before:**

```kotlin
package foobar

data class Value(
        val value: Value<*>? = null,
        override val unknownFields: Map<Int, pbandk.UnknownField> = emptyMap()
) : pbandk.Message {
       sealed class Value<V>(value: V) : pbandk.Message.OneOf<V>(value) {
              ...
       }
       ...
       companion object : pbandk.Message.Companion<Value> {
              ...
       }
       ...
}
```

**After:**

```kotlin
package foobar

data class Value(
        val value: Value<*>? = null,
        override val unknownFields: Map<Int, pbandk.UnknownField> = emptyMap()
) : pbandk.Message {
       sealed class Value<V>(value: V) : pbandk.Message.OneOf<V>(value) {
              ...
       }
       ...
       companion object : pbandk.Message.Companion<foobar.Value> {
              ...
       }
       ...
}
```
@garyp garyp merged commit 5108765 into master Dec 28, 2020
@garyp garyp deleted the fix-47-fqdn-oneoff-master branch December 28, 2020 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants