[Demonstration 1]

[Buggy Method]
@Override
public GuiScreen createConfigGui(GuiScreen parentScreen) {
    return new ExpandedBonemealGuiConfig(parentScreen);
}

[Buggy Hunk]
return new ExpandedBonemealGuiConfig(parentScreen);

[Patch]
return new DegradeExplodedBlocksGuiConfig(parentScreen);

[Demonstration 2]

[Buggy Method]
public static RelationFilter[] extractFilters(String propertyName, String propertyValue, String named, String sourceType, String targetType, UriInfo info) {
    List<RelationFilter> filters = new ArrayList<>();
    if (!propertyName.isEmpty() && !propertyValue.isEmpty()) {
        filters.add(RelationWith.property(propertyName, propertyValue));
    }
    if (!named.isEmpty()) {
        List<String> namedParam = info.getQueryParameters().get("named");
        if (namedParam == null || namedParam.isEmpty()) {
            throw new IllegalArgumentException("Malformed URL param, the right format is: " + "named=label1&named=label2&named=labelN");
        }
        filters.add(RelationWith.names(namedParam.toArray(new String[namedParam.size()])));
    }
    if (!sourceType.isEmpty()) {
        List<String> sourceParam = info.getQueryParameters().get("sourceType");
        if (sourceParam == null || sourceParam.isEmpty()) {
            throw new IllegalArgumentException("Malformed URL param, the right format is: " + "sourceType=type1&sourceType=type2&sourceType=typeN");
        }
        Class<? extends Entity<?, ?>>[] types = sourceParam.stream().map(typeString -> entityMap.get(typeString)).toArray(size -> new Class[size]);
        if (!sourceParam.isEmpty()) {
            filters.add(RelationWith.sourcesOfTypes(types));
        }
    }
    if (!targetType.isEmpty()) {
        List<String> targetParam = info.getQueryParameters().get("targetType");
        if (targetParam == null || targetParam.isEmpty()) {
            throw new IllegalArgumentException("Malformed URL param, the right format is: " + "targetType=type1&targetType=type2&targetType=typeN");
        }
        Class<? extends Entity<?, ?>>[] types = (Class<? extends Entity<?, ?>>[]) targetParam.stream().map(typeString -> entityMap.get(typeString)).toArray();
        if (!targetParam.isEmpty()) {
            filters.add(RelationWith.targetsOfTypes(types));
        }
    }
    return filters.isEmpty() ? RelationFilter.all() : filters.toArray(new RelationFilter[filters.size()]);
}

[Buggy Hunk]
.toArray();

[Patch]
.toArray(size -> new Class[size]);

[Demonstration 3]

[Buggy Method]
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    if (!initializeDB()) {
        Log.w(AUTHORITY, "Database unavailable...");
        return null;
    }
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    switch(sUriMatcher.match(uri)) {
        case NOTIFICATIONS:
            qb.setTables(DATABASE_TABLES[1]);
            qb.setProjectionMap(notificationMap);
            break;
        case ADVERSE_EVENTS:
            qb.setTables(DATABASE_TABLES[0]);
            qb.setProjectionMap(eventMap);
            break;
        default:
            throw new IllegalArgumentException("Unknown URI " + uri);
    }
    try {
        Cursor c = qb.query(database, projection, selection, selectionArgs, null, null, sortOrder);
        c.setNotificationUri(NotificationService.getContext().getApplicationContext().getContentResolver(), uri);
        return c;
    } catch (IllegalStateException e) {
        if (Aware.DEBUG)
            Log.e(Aware.TAG, e.getMessage());
        return null;
    }
}

[Buggy Hunk]
c.setNotificationUri(NotificationService.getContext().getApplicationContext().getContentResolver(), uri);

[Patch]
c.setNotificationUri(Plugin.getContext().getContentResolver(), uri);