You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DynamicMessage.setField has wrong check, preventing setting any ENUM type list on it!
This is a major bug; this has been introduced only in 2.6.0.
Here is the excerpt from the source:
public Builder setField(FieldDescriptor field, Object value) {
verifyContainingType(field);
ensureIsMutable();
if (field.getType() == FieldDescriptor.Type.ENUM) {
verifyEnumType(field, value);
}
...
And verifyEnumType doesn't check for repeated value; here it is:
private void verifyEnumType(FieldDescriptor field, Object value) {
if (value == null) {
throw new NullPointerException();
}
if (!(value instanceof EnumValueDescriptor)) {
throw new IllegalArgumentException(
"DynamicMessage should use EnumValueDescriptor to set Enum Value.");
}
...
If field is repeated, then its value is instanceof List, will never be EnumValueDescriptor!