gpt4 book ai didi

kotlin - 不同的枚举,protobuf 中的相同值

转载 作者:行者123 更新时间:2023-12-04 14:55:22 26 4
gpt4 key购买 nike

我有这样的 Protocol Buffer 定义:

package com.asd;

enum AType {
A1 = 0;
A2 = 1;
Unknown = 2;
}

enum BType {
B1 = 0;
B2 = 1;
Unknown = 2;
}
编译时,我收到此错误:

"Unknown" is already defined in "com.asd". Note that enum values useC++ scoping rules, meaning that enum values are siblings of theirtype, not children of it. Therefore, "Other" must be unique within"com.asd", not just within "BType".


除了使用不同的软件包之外,是否有解决此问题的方法?

最佳答案

我没有足够的声誉将其作为评论发布,而我的建议是一个甚至可能不起作用的黑客。但是你有没有尝试添加option allow_alias = true;在两个 enum并使用相同的值。
引用:https://developers.google.com/protocol-buffers/docs/proto#enum

关于kotlin - 不同的枚举,protobuf 中的相同值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68134072/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com