[Demonstration 1]

[Buggy Method]
@Test
public void testAsElement() {
    Set<Person> people = new HashSet<>();
    Person p1 = new Person(1);
    people.add(p1);
    people.add(p1);
    assertEquals(1, people.size());
}

[Buggy Hunk]
Set<Person> people = new HashSet<>();

[Patch]
Set<Person> people = new HashSet<Person>();

[Demonstration 2]

[Buggy Method]
@Override
public Iterable<IClasspathEntry> load(IJavaProject project) throws FileNotFoundException {
    Iterable<IClasspathEntry> classpath = super.load(project);
    if (configuration.isDownloadSources()) {
        List<IClasspathEntry> processed = new ArrayList<IClasspathEntry>();
        try {
            MavenProject mavenProject = registry.getProject(project.getProject()).getMavenProject(new NullProgressMonitor());
            MavenAndroidProject androidProject = factory.createAndroidProject(mavenProject);
            List<ArtifactRepository> repositories = mavenProject.getRemoteArtifactRepositories();
            for (IClasspathEntry entry : classpath) {
                try {
                    ClasspathAttributes attributes = new ClasspathAttributes(entry.getExtraAttributes());
                    if (CPE_LIBRARY == entry.getEntryKind() && !attributes.hasAttribute(JAVADOC_LOCATION_ATTRIBUTE_NAME)) {
                        Dependency dependency = findDependency(entry, androidProject.getNonRuntimeDependencies());
                        Artifact docs = maven.resolve(dependency.getGroup(), dependency.getName(), dependency.getVersion(), "jar", CLASSIFIER_DOCS, repositories, new NullProgressMonitor());
                        attributes.set(newClasspathAttribute(JAVADOC_LOCATION_ATTRIBUTE_NAME, getJavaDocUrl(docs.getFile())));
                        IClasspathEntry entryWithDocs = JavaCore.newLibraryEntry(entry.getPath(), entry.getSourceAttachmentPath(), null, entry.getAccessRules(), attributes.toArray(), entry.isExported());
                        processed.add(entryWithDocs);
                    } else {
                        processed.add(entry);
                    }
                } catch (Exception e) {
                    warn("could not resolve javadocs for classpath entry=[" + entry + "]");
                    processed.add(entry);
                }
            }
        } catch (CoreException e) {
            throw new ProjectConfigurationException(e);
        }
        return processed;
    }
    return classpath;
}

[Buggy Hunk]
if(configuration.isDownloadSources()) {

[Patch]
if(configuration.isDownloadJavaDoc()) {

[Demonstration 3]

[Buggy Method]
private void transmit() throws IOException {
    session.active();
    if (closing && !closed) {
        if (queue.isEmpty()) {
            if (key != null) {
                key.cancel();
                key = null;
            }
            channel.close();
            closed = true;
            logger.info("{} closed", getId());
            return;
        }
    }
    if (closed) {
        if (!queue.isEmpty()) {
            throw new ConnectionException("PeerClosedConnectionUnexpectedly");
        } else {
            // The processing of the READ on the channel has closed the connection.
            return;
        }
    }
    if (queue.isEmpty()) {
        logger.error("{} unexpected attempt to transmit", getId());
        return;
    }
    ByteBuffer next = queue.pop();
    logger.debug("{} sending {} bytes", getId(), next.remaining());
    channel.write(next);
    if (next.hasRemaining()) {
        logger.debug("{} re-queueing {} bytes", getId(), next.remaining());
        queue.head(next);
    } else {
        allocator.reuse(next);
    }
    logger.debug("{} queue is empty: {}", getId(), queue.isEmpty());
    enableReceive(queue.hasCapacity());
    enableTransmit(!queue.isEmpty() || closing);
}

[Buggy Hunk]
enableReceive(queue.hasCapacity());

[Patch]
session.enableRead(!source, queue.hasCapacity());