[Demonstration 1]

[Buggy Method]
public static <T> List<T> sort(final List<T> objects, final Visitor<T> visitor) {
    if (objects.size() <= 1) {
        return objects;
    }
    final Map<String, Node> nodes = new LinkedHashMap<String, Node>();
    // Create nodes
    for (final T obj : objects) {
        final String name = visitor.getName(obj);
        final Node node = new Node(name, obj);
        nodes.put(name, node);
    }
    // Link nodes
    for (final Node node : nodes.values()) {
        for (final String name : visitor.getReferences((T) node.object)) {
            final Node ref = nodes.get(name);
            if (ref == null) {
                throw new IllegalArgumentException("No such object in list: " + name);
            }
            node.references.add(ref);
            node.initialReferences.add(ref);
        }
    }
    boolean circuitFounded = false;
    for (final Node node : nodes.values()) {
        final Set<Node> visitedNodes = new HashSet<>();
        if (!normalizeNodeReferences(node, node, visitedNodes)) {
            circuitFounded = true;
            break;
        }
        node.references.addAll(visitedNodes);
    }
    //detect circus
    if (circuitFounded) {
        final Set<Circuit> circuits = new LinkedHashSet<Circuit>();
        for (final Node node : nodes.values()) {
            findCircuits(circuits, node, new Stack<Node>());
        }
        final ArrayList<Circuit> list = new ArrayList<Circuit>(circuits);
        Collections.sort(list);
        final List<List> all = new ArrayList<List>();
        for (final Circuit circuit : list) {
            all.add(unwrap(circuit.nodes));
        }
        throw new CircularReferencesException(all);
    }
    //Build Double Link Node List
    final Node rootNode = new Node(null, null);
    rootNode.previous = rootNode;
    rootNode.next = nodes.values().iterator().next();
    for (final Node node : nodes.values()) {
        node.previous = rootNode.previous;
        rootNode.previous.next = node;
        node.next = rootNode;
        rootNode.previous = node;
    }
    for (final Node node : nodes.values()) {
        for (final Node reference : node.references) {
            swap(node, reference, rootNode);
        }
    }
    final List sortedList = new ArrayList(nodes.size());
    Node currentNode = rootNode.next;
    while (currentNode != rootNode) {
        sortedList.add(currentNode.object);
        currentNode = currentNode.next;
    }
    return sortedList;
}

[Buggy Hunk]
final Set<Node> visitedNodes = new HashSet<>();

[Patch]
final Set<Node> visitedNodes = new HashSet<Node>();

[Demonstration 2]

[Buggy Method]
private Object convert(EClassifier classifier, String value) throws DeserializeException, MetaDataException {
    if (classifier != null) {
        if (classifier instanceof EClassImpl) {
            if (null != ((EClassImpl) classifier).getEStructuralFeature(WRAPPED_VALUE)) {
                IdEObject newObject = (IdEObject) getPackageMetaData().create((EClass) classifier);
                Class<?> instanceClass = newObject.eClass().getEStructuralFeature(WRAPPED_VALUE).getEType().getInstanceClass();
                if (value.equals("")) {
                } else {
                    if (instanceClass == Integer.class || instanceClass == int.class) {
                        try {
                            newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE), Integer.parseInt(value));
                        } catch (NumberFormatException e) {
                            throw new DeserializeException(lineNumber, value + " is not a valid integer value");
                        }
                    } else if (instanceClass == Long.class || instanceClass == long.class) {
                        newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE), Long.parseLong(value));
                    } else if (instanceClass == Boolean.class || instanceClass == boolean.class) {
                        newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE), value.equals(".T."));
                    } else if (instanceClass == Double.class || instanceClass == double.class) {
                        try {
                            newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE), Double.parseDouble(value));
                        } catch (NumberFormatException e) {
                            throw new DeserializeException(lineNumber, value + " is not a valid double floating point number");
                        }
                        newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE + "AsString"), value);
                    } else if (instanceClass == String.class) {
                        newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE), readString(value));
                    } else if (instanceClass.getName().equals("Tristate")) {
                        Object tristate = null;
                        if (value.equals(".T.")) {
                            tristate = getPackageMetaData().getEEnumLiteral("Tristate", "TRUE");
                        } else if (value.equals(".F.")) {
                            tristate = getPackageMetaData().getEEnumLiteral("Tristate", "FALSE");
                        } else if (value.equals(".U.")) {
                            tristate = getPackageMetaData().getEEnumLiteral("Tristate", "UNDEFINED");
                        }
                        newObject.eSet(newObject.eClass().getEStructuralFeature(WRAPPED_VALUE), tristate);
                    }
                }
                return newObject;
            } else {
                return processInline(classifier, value);
            }
        } else if (classifier instanceof EDataType) {
            return convertSimpleValue(classifier.getInstanceClass(), value);
        }
    }
    return null;
}

[Buggy Hunk]
} else if (instanceClass.getName().equals("Tristate")) {

[Patch]
} else if (instanceClass.getSimpleName().equals("Tristate")) {

[Demonstration 3]

[Buggy Method]
public boolean canUserExecute(IUser user, IGuild guild) {
    int userPermissions = Permissions.generatePermissionsNumber(user.getPermissionsForGuild(guild));
    return ((this.permissionsRequired & userPermissions) > 0) || (user.getLongID() == 235439851263098880L);
}

[Buggy Hunk]
return ((this.permissionsRequired & userPermissions) > 0) || (user.getLongID() == 235439851263098880L);

[Patch]
return ((this.permissionsRequired & userPermissions) > 0) || (user.getLongID() == 235439851263098880L) || (this.permissionsRequired == 0);