[Demonstration 1]

[Buggy Method]
@Override
@Nonnull
public JImmutableSet<T> insertAll(@Nonnull Iterator<? extends T> values) {
    JImmutableSet<T> answer = this;
    while (values.hasNext()) {
        answer.insert(values.next());
    }
    return answer;
}

[Buggy Hunk]
answer.insert(values.next());

[Patch]
answer = answer.insert(values.next());

[Demonstration 2]

[Buggy Method]
public static void textToJSON(String path) throws IOException {
    File f = new File(path);
    String result = "{\n\"events\" : [";
    String template = "\u0009{\n\u0009\"title\" : \"%s\",\n\u0009\"description\" : \"%s\",\n\u0009\"venue\" : {\n\u0009\u0009\"address\" : {\n\u0009\u0009\u0009\"country\" : \"%s\"\n\u0009\u0009\u0009}\n\u0009\u0009}\n\u0009},";
    BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(f)));
    String line = br.readLine();
    while (line != null) {
        String name = line.replaceAll("\"", "");
        String desc = br.readLine().replaceAll("\"", "");
        String country = br.readLine();
        assert (country != null);
        result += String.format(template, name, desc, country);
        line = br.readLine();
    }
    br.close();
    result = result.substring(0, result.length() - 2);
    result += "\u0009]\n}";
    File f2 = new File(path.replace(".txt", ".json"));
    FileWriter fw = new FileWriter(f2);
    fw.write(result);
    fw.close();
}

[Buggy Hunk]
result = result.substring(0, result.length() - 2);

[Patch]
result = result.substring(0, result.length() - 1);

[Demonstration 3]

[Buggy Method]
@Override
public List<String> getEventFilterPredicate(String project, List<EventFilter> eventFilter) {
    List<String> filters = new ArrayList<>(2);
    for (EventFilter filter : eventFilter) {
        StringBuilder builder = new StringBuilder();
        String collection = checkCollection(filter.collection);
        if (filter.aggregation == null) {
            builder.append(format("select \"_user\" from %s.%s", project, collection));
            if (filter.filterExpression != null) {
                builder.append(" where ").append(new ExpressionFormatter.Formatter(Optional.empty()).process(filter.getExpression(), true));
            }
            // TODO: timeframe
            filters.add((format("id in (%s)", builder.toString())));
        } else {
            builder.append(format("select \"_user\" from \"%s\".\"%s\"", project, collection));
            if (filter.filterExpression != null) {
                builder.append(" where ").append(new ExpressionFormatter.Formatter(Optional.empty()).process(filter.getExpression(), true));
            }
            String field;
            if (filter.aggregation.type == COUNT && filter.aggregation.field == null) {
                field = "_user";
            } else {
                field = filter.aggregation.field;
            }
            builder.append(" group by \"_user\" ");
            if (filter.aggregation.minimum != null || filter.aggregation.maximum != null) {
                builder.append(" having ");
            }
            if (filter.aggregation.minimum != null) {
                builder.append(format(" %s(\"%s\") >= %d ", filter.aggregation.type, field, filter.aggregation.minimum));
            }
            if (filter.aggregation.maximum != null) {
                if (filter.aggregation.minimum != null) {
                    builder.append(" and ");
                }
                builder.append(format(" %s(\"%s\") < %d ", filter.aggregation.type, field, filter.aggregation.maximum));
            }
            filters.add((format("id in (%s)", builder.toString())));
        }
    }
    return filters;
}

[Buggy Hunk]
builder.append(format("select \"_user\" from \"%s\".\"%s\"", project, collection));

[Patch]
builder.append(format("select \"_user\" from %s.%s", project, collection));