gitskarios / Gitskarios

GitHub Android application
MIT License
527 stars 73 forks source link

Does not compile lambda expression #638

Open natebass opened 7 years ago

natebass commented 7 years ago

When I try to compile the app from source I get this error.

/Users/NateBass/A/Android/Gitskarios/app/src/main/java/com/alorma/github/presenter/CommitInfoPresenter.java
Error:(23, 57) error: incompatible types: bad return type in lambda expression
Observable<Pair<GithubStatusResponse,Integer>> cannot be converted to Observable<? extends CAP#1>
where CAP#1 is a fresh type-variable:
CAP#1 extends Pair<GithubStatusResponse,Integer> from capture of ? extends Pair<GithubStatusResponse,Integer>
alorma commented 7 years ago

hi. I will check it.

Could you try to expand the lambda expression, what happens then?

natebass commented 7 years ago

In the editor I pressed alt-enter and "Expand lambda expression body to {...}". Is that what you mean? The code now looks like this, and it gives the same error.

Observable<GithubStatusResponse> shaCombinedStatus = new GetShaCombinedStatus(commitInfo.repoInfo, commitInfo.sha).observable()
        .onErrorResumeNext(throwable -> {
          return Observable.empty();
        })
        .map(o -> {
          return o.first;
        });
alorma commented 7 years ago

Weird, could you keep expanding lambda? You should get anonymous classes, and a ? somewhere, change it to return type of observable. It should work

natebass commented 7 years ago

I tried, and failed. No worries, I deleted that line for now so I can work on something :metal: