[Demonstration 1]

[Buggy Method]
public static TwoWayFieldBridge retrieveFieldBridge(Schema.Type type, Schema schema, String[] path) {
    switch(type) {
        case BYTES:
        case NULL:
            log.trace("type " + type + " not indexed");
        case INT:
            return NumericFieldBridge.INT_FIELD_BRIDGE;
        case LONG:
            return NumericFieldBridge.LONG_FIELD_BRIDGE;
        case FLOAT:
            return NumericFieldBridge.FLOAT_FIELD_BRIDGE;
        case DOUBLE:
            return NumericFieldBridge.DOUBLE_FIELD_BRIDGE;
        case UNION:
            for (Schema subSchema : schema.getTypes()) if (!subSchema.getType().equals(Schema.Type.NULL))
                return retrieveFieldBridge(subSchema.getType(), subSchema, path);
            break;
        case RECORD:
            String[] subPath = Arrays.copyOfRange(path, 1, path.length);
            for (Schema.Field field : schema.getFields()) {
                if (field.name().equals(path[1]))
                    return retrieveFieldBridge(field.schema().getType(), field.schema(), subPath);
            }
            break;
        case MAP:
            Schema subSchema = schema.getValueType();
            return retrieveFieldBridge(subSchema.getType(), subSchema, Arrays.copyOfRange(path, 1, path.length));
        case ARRAY:
            subSchema = schema.getElementType();
            return new TwoWayArrayBridge(retrieveFieldBridge(subSchema.getType(), subSchema, path));
        case ENUM:
        case FIXED:
        case STRING:
        case BOOLEAN:
            return new TwoWayString2FieldBridgeAdaptor(StringBridge.INSTANCE);
    }
    throw new CacheException("Unable to find " + path + " having type " + type);
}

[Buggy Hunk]
throw new CacheException("Unable to find "+path+" having type "+type);

[Patch]
throw new CacheException("Unable to find "+Arrays.toString(path)+" having type "+type);

[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 InvocationHandler getInvocationHandler(Method m) {
    final SpyPoint spyPoint = m.getAnnotation(SpyPoint.class);
    final Type[] parameterTypes = m.getParameterTypes();
    final String[] parameterNames = getParameterNames(m);
    return new InvocationHandler() {

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            String spyPointName = spyPoint.spyPointName().equals(SpyPoint.DEFAULT_POINT_NAME) ? proxy.getClass().getSimpleName() + "." + method.getName() : spyPoint.spyPointName();
            SpyResult<?> response;
            if (parameterTypes.length == 0) {
                response = Bond.spy(spyPointName, method.getReturnType());
            } else {
                Observation observation = Bond.obs(getObservationKey(parameterNames[0], parameterTypes[0]), args[0]);
                for (int i = 1; i < parameterTypes.length; i++) {
                    observation = observation.obs(getObservationKey(parameterNames[i], parameterTypes[i]), args[i]);
                }
                response = observation.spy(spyPointName, method.getReturnType());
            }
            if (spyPoint.requireAgentResult() && !response.isPresent()) {
                throw new IllegalStateException("You *must* mock out spy point: " + spyPointName);
            }
            Object retValue;
            if (response.isPresent()) {
                retValue = response.get();
            } else {
                retValue = method.invoke(proxy, args);
            }
            if (spyPoint.spyResult()) {
                Bond.obs("result", retValue).spy(spyPointName + ".result");
            }
            return retValue;
        }
    };
}

[Buggy Hunk]
? proxy.getClass().getSimpleName() + "." + method.getName()

[Patch]
? method.getDeclaringClass().getSimpleName() + "." + method.getName()