@Override
  public R groupBy(Projection<?> first, Projection<?> ... rest) {
    if (!query.groupBy().isEmpty()) {
      throw new IllegalStateException("GroupBy was already set");
    }

    final List<Projection<?>> all = new ArrayList<>();
    all.add(first);
    all.addAll(Arrays.asList(rest));

    final List<Expression> groupBy = all.stream().map(Matchers::toExpression).collect(Collectors.toList());
    return newReader(query.addGroupBy(groupBy));
  }
Expose current query (used mostly for SPIs)
criteria/common/src/org/immutables/criteria/repository/AbstractReader.java