Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newbie - is this compatible with RxJava 2.0 #16

Open
amiracam opened this issue Nov 10, 2017 · 3 comments
Open

newbie - is this compatible with RxJava 2.0 #16

amiracam opened this issue Nov 10, 2017 · 3 comments

Comments

@amiracam
Copy link

i.e. does it support Flowable api ? thanks

@akarnokd
Copy link
Member

Hi. No and the project is practically dead.

@amiracam
Copy link
Author

great, so jus use RxJava from groovy I guess

@sfitts
Copy link

sfitts commented Nov 30, 2017

@amiracam that works, but... you have to watch out for overloaded methods that that have both closure compatible and non-closure compatible arguments. For example onErrorResumeNext. All variants of this accept either the source to resume to or a Function which produces the source. Now, if that Function were of the Java 8 variety then Groovy's standard closure conversion would work its magic and all would be well. But since Function here is the RxJava2 defined class (and isn't explicitly declared as a functional interface) Groovy doesn't know what to do and you get:

Caused by: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method io.reactivex.internal.operators.maybe.MaybeFromCallable#onErrorResumeNext.
Cannot resolve which method to invoke for [class io.vantiq.reactivex.Rx2Spec$__spock_feature_0_0_closure2] due to overlapping prototypes between:
	[interface io.reactivex.MaybeSource]
	[interface io.reactivex.functions.Function]
	... 1 more

This means that in these cases you have to explicitly cast the closure to whatever the functional interface class is and then it works (since these classes do only have one method in them).

This is essentially a variant of the issue that this library was intended to solve via meta-programming. RxJava2 has a few more of pseudo-functional interfaces to handle and a few more classes to instrument, but other than that it would work the same.

In fact, the constant need to add the cast has started to annoy me enough that I'm just starting on creating the RxJava 2 variant. Once I'm done I'll post a gist of that here (in case anyone else can use them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants