[Demonstration 1]

[Buggy Method]
private static SampleConfig override(SampleConfig sampleConfig, JsonNode sampleConfigOverrides) {
    // We use JSON merging to facilitate this override mechanism:
    // 1. Convert the SampleConfig into a JSON tree.
    // 2. Convert the overrides file into a JSON tree with arbitrary schema.
    // 3. Overwrite object fields of the SampleConfig tree where field names match.
    // 4. Convert the modified SampleConfig tree back into a SampleConfig.
    if (sampleConfigOverrides != null) {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode tree = mapper.valueToTree(sampleConfig);
        merge((ObjectNode) tree, (ObjectNode) sampleConfigOverrides);
        try {
            return mapper.treeToValue(tree, SampleConfig.class);
        } catch (Exception e) {
            throw new RuntimeException("failed to parse config to node: " + e.getMessage());
        }
    }
    return sampleConfig;
}

[Buggy Hunk]
ObjectMapper mapper = new ObjectMapper();

[Patch]
ObjectMapper mapper = new ObjectMapper().registerModule(new GuavaModule());

[Demonstration 2]

[Buggy Method]
@Override
public A next() {
    if (!hasNext())
        throw new NoSuchElementException();
    return xsIterator().hasNext() ? xsIterator().next() : ysIterator().next();
}

[Buggy Hunk]
return xsIterator().hasNext() ? xsIterator().next() : ysIterator().next();

[Patch]
return !iteratedXs ? xsRef.get().next() : ysRef.get().next();

[Demonstration 3]

[Buggy Method]
public ArrayList<EntityField> calcBranch(ArrayList<ArrayList<EntityField>> paths, ArrayList<EntityField> init, EntityField start, EntityField last) {
    while (true) {
        EntityField[] next = returnNext(init.get(init.size() - 1), last);
        if (next.length > 0) {
            for (int i = 0; i < next.length; i++) {
                if (i != 0) {
                    //System.out.println(init.get(init.size()-1).pos.x +" "+ init.get(init.size()-1).pos.y +" "+ next[i].pos.x +" "+ next[i].pos.y);
                    ArrayList<EntityField> temp = (ArrayList<EntityField>) init.clone();
                    temp.add(next[i]);
                    paths.add(calcBranch(paths, temp, next[i], init.get(init.size() - 1)));
                }
            }
        } else {
            return init;
        }
        last = init.get(init.size() - 1);
        //System.out.println("next" + next[0].pos.x + " " + next[0].pos.y);
        init.add(next[0]);
    }
}

[Buggy Hunk]
if(i != 0) {

[Patch]
if(i != 0 && (next[i].text.equals("CH")||next[i].text.equals("C"))) {