code: public List<String> getRecipientsFromExpression(String expression)
      throws DataAccessException, ParseException {
          Object recip = context.evaluate(expression);
          if (recip == null) {
              context.logWarn("Warning: Recipient expression '" + expression + "' resolves to null");
          }
  
          List<String> recips = new ArrayList<>();
          if (recip instanceof String) {
              if (!((String)recip).isEmpty()) {  // null list evaluates to empty string (why?)
                  Workgroup group = UserGroupCache.getWorkgroup((String)recip);
                  if (group != null)
                      recips.addAll(getGroupEmails(Arrays.asList(new String[]{group.getName()})));
                  else
                      recips.add((String)recip);
              }
          }
          else if (recip instanceof List) {
              for (Object email : (List)recip) {
                  Workgroup group = UserGroupCache.getWorkgroup(email.toString());
                  if (group != null) {
                      for (String groupEmail : getGroupEmails(Arrays.asList(new String[]{group.getName()}))) {
                          if (!recips.contains(groupEmail))
                              recips.add(groupEmail);
                      }
                  }
                  else {
                      if (!recips.contains(email))
                          recips.add(email.toString());
                  }
              }
          }
          else {
              throw new ParseException("Recipient expression resolved to unsupported type: " + expression + ": " + recip);
          }
          return recips;
      }
docs: Must resolve to type of String or List<String>.
  If a value corresponds to a group name, returns users in the group.