Unable to set multiple Capabilities in a single message when using Java/Kotlin protobuf
nephyst opened this issue · 4 comments
nephyst commented
AgentCapabilities capabilities = 4;
ServerCapabilities capabilities = 7;
The intent of these fields is to pack multiple flags into a single field. According to the protobuf docs, Enum fields only allow a single value. When compiled to Java or Kotlin the generated objects do not allow for setting multiple capability flags to a single enum.
This can be fixed by changing the field to be an int32 with manual bit packing, or by repeating the enum fields.
nephyst commented
This is the setCapabilities method in the java ServerToAgent object builder:
public Builder setCapabilities(opamp.proto.Opamp.ServerCapabilities value) {
if (value == null) {
throw new NullPointerException();
}
capabilities_ = value.getNumber();
onChanged();
return this;
}
tigrannajaryan commented
I think we need to change the bit fields to uint64. The enum declarations can stay to show what the bit values are.
tigrannajaryan commented
nephyst commented
Yes, thank you!