[Demonstration 1]

[Buggy Method]
public boolean execute(MinecartMember<?> member, Entity entity) {
    final CommonMinecart<?> minecart = member.getEntity();
    final MinecartMember<?> other = MinecartMemberStore.get(entity);
    // Some default exception rules
    if (!member.isInteractable() || entity.isDead() || member.isCollisionIgnored(entity)) {
        return false;
    }
    // Ignore passengers
    if (entity.isInsideVehicle() && entity.getVehicle() instanceof Minecart) {
        return false;
    }
    // Exception rules for other Minecarts
    if (other != null) {
        if (!other.isInteractable()) {
            return false;
        }
        // Ignore collisions with same group
        if (member.getGroup() == other.getGroup()) {
            return false;
        }
        // Check if both minecarts are on the same vertical column
        RailLogic logic1 = member.getRailLogic();
        if (logic1 instanceof RailLogicVerticalSlopeDown) {
            RailLogic logic2 = other.getRailLogic();
            if (logic2 instanceof RailLogicVerticalSlopeDown) {
                Block b1 = member.getBlock(logic1.getDirection());
                Block b2 = other.getBlock(logic2.getDirection());
                if (BlockUtil.equals(b1, b2)) {
                    return false;
                }
            }
        }
    } else if (member.isMovementControlled()) {
        // For other entity types - ignore collision
        return false;
    }
    // Determine if the player is pushing the train or getting run over by it
    if (this != CANCEL) {
        if (entity instanceof Player && this != SKIP) {
            // Get train's X and Z velocity
            double trainX = member.getLimitedVelocity().getX();
            double trainZ = member.getLimitedVelocity().getZ();
            // Get player's X and Z velocity
            double playerSpeed = ((Player) entity).getWalkSpeed();
            Vector playerVelocity = ((Player) entity).getEyeLocation().getDirection();
            playerVelocity.multiply(playerSpeed);
            double playerX = playerVelocity.getX();
            double playerZ = playerVelocity.getZ();
            /*
             * Make sure the player is moving before comparing speeds and directions.
             * If the player is not moving, then the train is running over the player,
             * and fall through to the regular logic below.
             */
            if (Math.abs(playerX) + Math.abs(playerZ) > 0.03) {
                if (Math.abs(trainX) + Math.abs(trainZ) < 0.03) {
                    // Train isn't moving (much if at all). Return true to let player push train.
                    return true;
                }
                if (Math.abs(trainX) > Math.abs(trainZ) && playerX * trainX > 0 && Math.abs(playerX) > Math.abs(trainX)) {
                    // Player moving in same direction as train, faster than train. Return true to push train.
                    return true;
                }
                if (Math.abs(trainX) <= Math.abs(trainZ) && playerZ * trainZ >= 0 && Math.abs(playerZ) > Math.abs(trainZ)) {
                    // Player moving in same direction as train, faster than train. Return true to push train.
                    return true;
                }
            }
        }
    }
    switch(this) {
        case ENTER:
            if (!minecart.hasPassenger() && minecart.isVehicle() && Util.canBePassenger(entity) && member.canCollisionEnter()) {
                minecart.setPassenger(entity);
            }
            return false;
        case PUSH:
            push(member, entity);
            return false;
        case CANCEL:
            return false;
        case DAMAGE:
        case DAMAGENODROPS:
            if (member.isMoving() && member.isHeadingTo(entity)) {
                if (this == DAMAGENODROPS) {
                    TCListener.cancelNextDrops = true;
                }
                Double minecartEnergy = member.getForceSquared() * member.getProperties().getTrainProperties().getCollisionDamage();
                damage(member, entity, minecartEnergy);
                push(member, entity);
                if (this == DAMAGENODROPS) {
                    TCListener.cancelNextDrops = false;
                }
            }
            return false;
        case KILLNODROPS:
        case KILL:
            if (member.isMoving() && member.isHeadingTo(entity)) {
                if (this == KILLNODROPS) {
                    TCListener.cancelNextDrops = true;
                }
                damage(member, entity, (double) Short.MAX_VALUE);
                if (this == KILLNODROPS) {
                    TCListener.cancelNextDrops = false;
                }
            }
            return false;
        case LINK:
            if (other != null) {
                // Perform default linking logic
                return !MinecartGroupStore.link(member, other);
            }
            return true;
        case SKIP:
            // Should not ever be called. If it is, do nothing.
            TrainCarts.plugin.log(Level.WARNING, "Collision mode SKIP should not be called");
            return false;
        default:
            if (other != null) {
                // Perform default logic: Stop this train
                if (member.isHeadingTo(entity)) {
                    member.getGroup().stop();
                }
                return false;
            }
            return true;
    }
}

[Buggy Hunk]
minecart.setPassenger(entity);

[Patch]
minecart.addPassenger(entity);

[Demonstration 2]

[Buggy Method]
public void actionCommand() {
    if (panel.arrow_exists && (btn1.btn1_choice != 4 && btn1.btn1_choice != 2 && !(panel.sleeping))) {
        moveArrow();
    }
}

[Buggy Hunk]
if(panel.arrow_exists && (btn1.btn1_choice != 4 && btn1.btn1_choice != 2 && !(panel.sleeping))){

[Patch]
if(panel.arrow_exists && (btn1.btn1_choice != 4 && btn1.btn1_choice != 2)){

[Demonstration 3]

[Buggy Method]
@Override
public Point3D[] getPolyline3D() throws InvalidAttributeTypeException, AttributeNotInitializedException {
    try {
        assertAssignedAndNotNull();
        switch(this.type) {
            case POINT:
                Point2D pt2 = (Point2D) this.value;
                return new Point3D[] {//TODO: Fix code: new Point3fp(pt2.getX(),pt2.getY(),0f)
                };
            case POINT3D:
                return new Point3D[] { ((Point3D) this.value).clone() };
            case POLYLINE:
                {
                    Point2D[] current = (Point2D[]) this.value;
                    Point3D[] tab = new Point3D[current.length];
                    for (int i = 0; i < current.length; ++i) {
                        //					TODO: Fix code tab[i] = new Point3f(
                        //								current[i].getX(),
                        //								current[i].getY(),
                        //								0f);
                    }
                    return tab;
                }
            case POLYLINE3D:
                return (Point3D[]) this.value;
            case STRING:
                return parsePolyline3D((String) this.value, false);
            case OBJECT:
                if (this.value instanceof Tuple2D<?>) {
                    Tuple2D<?> t2 = (Tuple2D<?>) this.value;
                    return new Point3D[] {// FIXME: Fixcode: new Point3f(t2.getX(),t2.getY(),0)
                    };
                } else if (this.value instanceof Tuple3D<?>) {
                    Tuple3D<?> t2 = (Tuple3D<?>) this.value;
                    return new Point3D[] {// FIXME: Fixcode: new Point3f(t2.getX(), t2.getY(), t2.getZ())
                    };
                } else if (this.value.getClass().isArray()) {
                    Class<?> elementType = this.value.getClass().getComponentType();
                    if (Point3D.class.equals(elementType)) {
                        return (Point3D[]) this.value;
                    }
                    int size = Array.getLength(this.value);
                    if (Tuple3D.class.isAssignableFrom(elementType)) {
                        Point3D[] pa3 = new Point3D[size];
                        for (int i = 0; i < pa3.length; ++i) {
                            Tuple3D<?> t = (Tuple3D<?>) Array.get(this.value, i);
                            // FIXME: Fixcode: new Point3f(t);
                            pa3[i] = null;
                        }
                        return pa3;
                    }
                    if (Tuple2D.class.isAssignableFrom(elementType)) {
                        Point3D[] pa3 = new Point3D[size];
                        for (int i = 0; i < pa3.length; ++i) {
                            Tuple2D<?> t = (Tuple2D<?>) Array.get(this.value, i);
                            // FIXME: Fixcode: new Point3f(t.getX(), t.getY(), 0);
                            pa3[i] = null;
                        }
                        return pa3;
                    }
                }
                break;
            case BOOLEAN:
            case COLOR:
            case DATE:
            case IMAGE:
            case INTEGER:
            case REAL:
            case TIMESTAMP:
            case URI:
            case URL:
            case UUID:
            case INET_ADDRESS:
            case ENUMERATION:
            case TYPE:
            default:
        }
    } catch (ClassCastException exception) {
        //
    } catch (NumberFormatException exception) {
        //
    }
    throw new InvalidAttributeTypeException();
}

[Buggy Hunk]
((Point3D)this.value).clone()

[Patch]
((Point3D<?,?>)this.value).clone()