Closed santhanamk closed 1 month ago
This is a limitation in C++ and I believe Protoc also has it. Your files don't reproduce the error you're seeing.
I've written this
enum Test {
PHONE = 0;
}
enum TestDifferentEnum {
PHONE = 0;
}
and protoc complains as well
> protoc: stdout: . stderr: squareup/proto3/kotlin/file1.proto:6:3: "PHONE" is already defined.
squareup/proto3/kotlin/file1.proto:6:3: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. Therefore, "PHONE" must be unique within the global scope, not just within "TestDifferentEnum".
I get this error when there are two proto files.
Roughly it is like below:
file1.proto:
file2.proto:
The error is:
Cause: multiple enums share constant PHONE
I am using wire compiler 5.0.0 If I do this through Android Studio or command line I get this error.
Command line command looks like this:
java -jar $WIRE_COMPILER_JAR \ --proto_path=./app/src/main/proto \ --kotlin_out=$PROTO_DEST_DIR \
If I use protoc this works fine. Is this something that can be fixed?
Thanks for your help.