code: private static boolean isProto3EnumField(FieldDescriptor descriptor) {
      return descriptor.getType() == Descriptors.FieldDescriptor.Type.ENUM
          && descriptor.getFile().getSyntax() == Syntax.PROTO3;
    }
docs: Proto3 enums fields can accept and return unknown values via the get<Field>Value() methods, we
  use those methods instead of the methods that deal with the enum constants in order to support
  unknown enum values. If we didn't, any field with an unknown enum value would throw an
  exception when we call {@code getNumber()} on the enum.
  
  <p>For comparison, in proto2 unknown values always get mapped to 0, so this problem doesn't
  exist. Also, in proto2, the 'Value' functions don't exist, so we can't use them.