Skip to content

Varargs cause compiler warnings #359

@samuelgruetter

Description

@samuelgruetter

I'm trying to use the concat operator, but I can't use it without getting a compiler warning. Here's my code:

Observable<HorrorMovie> horrorMoviesWithException() {
    Observable<HorrorMovie> movies = Observable.from(new HorrorMovie());
    Observable<HorrorMovie> ex = Observable.error(new Exception("test")); 
    return Observable.concat(movies, ex); // (WARNING)
}

I get the warning "Type safety: A generic array of Observable<CovarianceTest.HorrorMovie> is created for a varargs parameter".

This problem was discussed on stackoverflow and this bug report explains why it's not going to be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions