-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
2.x: GroupedObservable#getKey is annotated as Nullable #5448
Comments
Actually, the implementation allows null keys because such keys are not part of the sequence. |
But as far as I can tell, the only way to produce a null key is to return null from the keySelector function, yes? But said Function interface has its return type annotated as I'm guessing the topic regarding annotations on the functional interfaces has been brought up before, is there anywhere I can read more about the plans for this? |
Ah, Kotlin. Java completely ignores these annotations and as it seems, Kotlin 1.1.3 brought up this trouble around nullability annotations. I'm starting to lean towards removing all such annotations from the functional types. #5442 is the most recent discussion. |
Dddamn this is bad. What if we try to convert all RxJava tests from Java to Kotlin then compile and run them with Kotlin 1.1.3 to see if it creates potential problems? |
You could create a Kotlin project and just write up streams with functional parameters to see what doesn't compile. I'd expect a thousand flows though. |
Closing via #5449. |
Hi Guys, could you please help me for this https://stackoverflow.com/questions/47595813/rxkotlin-groupby-is-not-working? working in rxjava but not kotlin. highly apreciate your help |
(RxJava 2.1.0)
The
GroupedObservable
's key that the group was created with is annotated asNullable
(in both the return type and in the constructor parameter).However, the key is only ever created from the
keySelector
(inObservableGroupBy
), which is declared as a Function (and hence has@NonNull
return type). It should therefore be considered a warning to return a null key for a group.I propose that RxJava actively verifies that the returned key is non-null and then change the
Nullable
annotations inGroupedObservable
toNonNull
correspondingly.The text was updated successfully, but these errors were encountered: