[Demonstration 1]

[Buggy Method]
private void drawHeatFluxSensors(Graphics2D g) {
    List<HeatFluxSensor> heatFluxSensors = model.getHeatFluxSensors();
    if (heatFluxSensors.isEmpty())
        return;
    g.setStroke(thinStroke);
    Symbol.HeatFluxSensor s = new Symbol.HeatFluxSensor();
    float w = HeatFluxSensor.RELATIVE_WIDTH * model.getLx();
    float h = HeatFluxSensor.RELATIVE_HEIGHT * model.getLy();
    // use view height to set icon dimension so that the sensor doesn't get distorted
    s.setIconWidth((int) (w * getHeight() / (xmax - xmin)));
    s.setIconHeight((int) (h * getHeight() / (ymax - ymin)));
    float iconW2 = s.getIconWidth() * 0.5f;
    float iconH2 = s.getIconHeight() * 0.5f;
    g.setFont(sensorReadingFont);
    int x, y;
    float rx, ry;
    String str;
    synchronized (heatFluxSensors) {
        for (HeatFluxSensor f : heatFluxSensors) {
            Rectangle2D.Float r = (Rectangle2D.Float) f.getShape();
            r.width = w;
            r.height = h;
            rx = (f.getX() - xmin) / (xmax - xmin);
            ry = (f.getY() - ymin) / (ymax - ymin);
            if (rx >= 0 && rx < 1 && ry >= 0 && ry < 1) {
                x = (int) (rx * getWidth() - iconW2);
                y = (int) (ry * getHeight() - iconH2);
                str = HEAT_FLUX_FORMAT.format(f.getValue()) + "W/m" + '\u00B2';
                if (f.getAngle() != 0)
                    g.rotate(f.getAngle(), x + s.wSymbol / 2, y + s.hSymbol / 2);
                centerString(str, g, (int) (x + iconW2), y - 5, true);
                if (f.getLabel() != null)
                    centerString(f.getLabel(), g, (int) (x + iconW2), y + s.getIconHeight() + 12, false);
                s.paintIcon(this, g, x, y);
                if (f.getAngle() != 0)
                    g.rotate(-f.getAngle(), x + s.wSymbol / 2, y + s.hSymbol / 2);
            }
        }
    }
}

[Buggy Hunk]
Symbol.HeatFluxSensor s = new Symbol.HeatFluxSensor();

[Patch]
Symbol.HeatFluxSensor s = new Symbol.HeatFluxSensor(false);

[Demonstration 2]

[Buggy Method]
@Override
public Object visitStAssg(SCalcParser.StAssgContext ctx) {
    // Check to see that the symbol is already defined
    Symbol var = curScope.resolve(ctx.getChild(0).getText());
    if (var == null)
        throw new IllegalArgumentException("Variable not defined (" + ctx.getChild(1).getText() + ")");
    int val = (int) visit(ctx.getChild(2));
    valueTable.replace(var, val);
    return null;
}

[Buggy Hunk]
ctx.getChild(1).getText() + ")");

[Patch]
ctx.getChild(0).getText() + ")");

[Demonstration 3]

[Buggy Method]
private double getSX(double angle, double l, double h) {
    //Gets the height at specific angle
    double hr = l * (Math.cos(Math.toRadians(angle) - Math.cos(Math.toRadians(270)))) + h;
    //Force of gravity
    double g = 9.82;
    //Kinetic energy at specific angle
    double KE = Math.sin(Math.toRadians(angle) + Math.toRadians(90)) * l * g;
    //Initial velocity at specific angle
    double V0 = Math.sqrt(2 * KE);
    //Initial velocity in x direction at specific angle
    double VOX = Math.cos(Math.toRadians(angle)) * V0;
    //Initial velocity in y direction at specific angle
    double V0Y = Math.sin(Math.toRadians(angle)) * V0;
    //Time that the projectile stays in the air. Depends on the initial velocity in the y direction and initial height
    double t = (-V0Y - (Math.sqrt((Math.pow(V0Y, 2)) + (2 * g * hr)))) / -g;
    //Gets the displacement in the x direction after "launch"
    double SX = t * VOX;
    //Gets the initial displacement from the center of the pendulum
    double DX = Math.sin(Math.toRadians(angle)) * l;
    //Returns the total displacement of the projectile
    return SX + DX;
}

[Buggy Hunk]
double hr = l * (Math.cos(Math.toRadians(angle) - Math.cos(Math.toRadians(270)))) + h;

[Patch]
double hr = l*(Math.cos(Math.toRadians(angle) + Math.toRadians(180))) + h;