[Demonstration 1]

[Buggy Method]
@EventHandler(priority = EventPriority.HIGH)
public void onBlockPlace(BlockPlaceEvent e) {
    RedProtect.logger.debug("BlockListener - Is BlockPlaceEvent event! Cancelled? " + e.isCancelled());
    if (e.isCancelled()) {
        return;
    }
    Player p = e.getPlayer();
    Block b = e.getBlockPlaced();
    World w = p.getWorld();
    Material m = null;
    if (e.getItemInHand() != null) {
        m = e.getItemInHand().getType();
    }
    Boolean antih = RPConfig.getBool("region-settings.anti-hopper");
    Region r = RedProtect.rm.getTopRegion(b.getLocation());
    if (r != null && RPConfig.getGlobalFlagList(p.getWorld().getName() + ".if-build-false.place-blocks").contains(b.getType().name())) {
        return;
    }
    if (r != null && m != null && !r.canMinecart(p) && (m.name().contains("MINECART") || m.name().contains("BOAT"))) {
        RPLang.sendMessage(p, "blocklistener.region.cantplace");
        e.setCancelled(true);
        return;
    }
    try {
        if (r != null && !r.canBuild(p) && !r.canPlace(b)) {
            RPLang.sendMessage(p, "blocklistener.region.cantbuild");
            e.setCancelled(true);
        } else {
            if (!RedProtect.ph.hasPerm(p, "redprotect.bypass") && antih && m != null && (m.equals(Material.HOPPER) || m.name().contains("RAIL"))) {
                int x = b.getX();
                int y = b.getY();
                int z = b.getZ();
                Block ib = w.getBlockAt(x, y + 1, z);
                if (!cont.canBreak(p, ib) || !cont.canBreak(p, b)) {
                    RPLang.sendMessage(p, "blocklistener.container.chestinside");
                    e.setCancelled(true);
                    return;
                }
            }
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

[Buggy Hunk]
if (r != null && !r.canBuild(p) && !r.canPlace(b)) {

[Patch]
if (r != null && !r.canBuild(p) && !r.canPlace(b.getType())) {

[Demonstration 2]

[Buggy Method]
@Override
protected Optional<ImageStore> call() throws Exception {
    File file = new File("dump/" + fileName);
    if (file.exists()) {
        return Optional.empty();
    }
    boolean mkdirs = file.getParentFile().mkdirs();
    if (mkdirs) {
        log.info("directory for dumping files created!");
    }
    downloadContent(new URL(url), file);
    return Optional.of(new ImageStore(tweet, new Image(file.toPath().toUri().toURL().toExternalForm()), file, date, mediaId));
}

[Buggy Hunk]
return Optional.of(new ImageStore(tweet, new Image(file.toPath().toUri().toURL().toExternalForm()), file, date, mediaId));

[Patch]
return Optional.of(new ImageStore(tweet, new Image(file.toPath().toUri().toURL().toExternalForm()), file, date.toInstant(), mediaId));

[Demonstration 3]

[Buggy Method]
@Override
protected void internalTransform(Body body, String phaseName, @SuppressWarnings("rawtypes") Map options) {
    cfg = new BriefUnitGraph(body);
    defs = new SimpleLocalDefs(cfg);
    for (Unit unit : body.getUnits()) {
        if (unit instanceof AssignStmt) {
            // Get operands
            Value lhsOp = ((AssignStmt) unit).getLeftOp();
            Value rhsOp = ((AssignStmt) unit).getRightOp();
            if (rhsOp instanceof BinopExpr) {
                // x = y + z
                String symbol = ((BinopExpr) rhsOp).getSymbol();
                Value op1 = ((BinopExpr) rhsOp).getOp1();
                Value op2 = ((BinopExpr) rhsOp).getOp2();
                checkCondition(symbol, op1, op2, unit, body.getMethod());
                switch(symbol) {
                    case " + ":
                    case " - ":
                        checkConversion(op1, (byte) 0b100, unit, body.getMethod());
                        checkConversion(op2, (byte) 0b100, unit, body.getMethod());
                        break;
                    case " / ":
                    case " % ":
                    case " >> ":
                    case " >>> ":
                        // no encryption schemes for these operations currently,
                        // so need conversions
                        checkConversion(op1, unit, body.getMethod());
                        checkConversion(op2, unit, body.getMethod());
                }
            } else if (rhsOp instanceof StaticInvokeExpr) {
                // Math.floor()
                SootMethod method = ((StaticInvokeExpr) rhsOp).getMethod();
                String className = method.getDeclaringClass().getName();
                if (className.equals("java.lang.Math"))
                    checkConversion(lhsOp, unit, body.getMethod());
            }
        } else if (unit instanceof IfStmt) {
            Value condition = ((IfStmt) unit).getCondition();
            if (condition instanceof BinopExpr) {
                Value op1 = ((BinopExpr) condition).getOp1();
                Value op2 = ((BinopExpr) condition).getOp2();
                checkCondition(((BinopExpr) condition).getSymbol(), op1, op2, unit, body.getMethod());
            }
        } else if (unit instanceof InvokeStmt) {
            handleInvokeExpr(body.getMethod(), unit);
        }
    }
}

[Buggy Hunk]
protected void internalTransform(Body body, String phaseName, @SuppressWarnings("rawtypes") Map options) {

[Patch]
protected synchronized void internalTransform(Body body, String phaseName, @SuppressWarnings("rawtypes") Map options) {