[Demonstration 1]

[Buggy Method]
@SuppressWarnings("unchecked")
public C where(@NonNull Function1<C, C> block) {
    return block.apply((C) clone());
}

[Buggy Hunk]
return block.apply((C) clone());

[Patch]
return where(block.apply(emptyClone()));

[Demonstration 2]

[Buggy Method]
private FxpStatus transfer_single(File sourceFile, File destinationFile, Host source, Host destination) throws IOException {
    FTPClient source_client = connect(source);
    FTPClient target_client = connect(destination);
    File partFile = destinationFile.derive(destinationFile.getName() + ".part");
    try {
        /*
			 * Send the commands that indicate a transaction needs to happen
			 * TODO: Rework to use short commands?
			 */
        target_client.sendCommand("TYPE I");
        source_client.sendCommand("TYPE I");
        target_client.sendCommand("PASV");
        source_client.sendCommand("PORT " + filterPortNumber(target_client.getReplyString()));
        /*
			 * Transfer the file data
			 */
        createDirectoryTree(destinationFile, target_client);
        createDirectoryTree(sourceFile, source_client);
        /*
			 * Send the STOR and RETR commands to the corresponding FTP servers.
			 */
        logger.debug("sending store and retreive commands");
        executor.submit(new FxpCommandThread(target_client, "STOR " + partFile.getName()));
        executor.submit(new FxpCommandThread(source_client, "RETR " + sourceFile.getName()));
        /*
			 * Periodically check the size of the partfile and compare it to the size of the file that
			 * is being transferred.
			 */
        AtomicInteger counter = new AtomicInteger();
        AtomicLong current_size = new AtomicLong();
        AtomicLong expected_size = new AtomicLong(get(sourceFile, source).getSize());
        while (current_size.get() != expected_size.get() && counter.get() >= FILESIZE_EQUAL_CHECKS) {
            Thread.sleep(FILESIZE_COMPARE_INTERVAL);
            long filesize = get(partFile, destination).getSize();
            if (filesize == current_size.get()) {
                // If these are equal, the file isn't transferring correctly
                counter.incrementAndGet();
            }
            current_size.set(filesize);
        }
        /*
			 * Check to see if the file sizes are different
			 */
        if (expected_size.get() != get(partFile, destination).getSize()) {
            // TODO: the files have not successfully transferred
            logger.warn("could not transfer file {}/{}", sourceFile.getDirectory(), sourceFile.getName());
            return FxpStatus.ERROR;
        } else /*
			 * If they aren't, we can assume the files are equal
			 */
        {
            rename(partFile, destinationFile, destination);
            logger.info("file transferred successfully");
            return FxpStatus.OK;
        }
    } catch (Exception ex) {
        logger.catching(ex);
        return FxpStatus.ERROR;
    } finally {
        source_client.disconnect();
        target_client.disconnect();
    }
}

[Buggy Hunk]
while (current_size.get() != expected_size.get() && counter.get() >= FILESIZE_EQUAL_CHECKS) {

[Patch]
while (current_size.get() != expected_size.get() && counter.get() <= FILESIZE_EQUAL_CHECKS) {

[Demonstration 3]

[Buggy Method]
public void run() {
    while (!gameover) {
        if (canMove()) {
            clearBlock();
            block.y++;
        } else {
            //check has a row been filled
            updateGrid();
            block = nextBlock;
            nextBlock = new Block();
        }
        for (int i = 0; i < 4; i++) {
            if (!grid[block.cordinate(i)[0]][block.cordinate(i)[1]].equals(EMPTY)) {
                gameover = true;
            }
        }
        addBlock();
        repaint();
        try {
            Thread.sleep(300);
        } catch (Exception e) {
            //ignore exception
        }
    }
}

[Buggy Hunk]
if (canMove()) {

[Patch]
if (canMoveDown()) {