-
Notifications
You must be signed in to change notification settings - Fork 7.6k
1.x: Change the signature of ignoreElements is also an implicit cast to whatever type you want. #3451
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
Conversation
…atever type you want.
public final Observable<T> ignoreElements() { | ||
return lift(OperatorIgnoreElements.<T> instance()); | ||
public final <R> Observable<R> ignoreElements() { | ||
return lift(OperatorIgnoreElements.<R, T>instance()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, there is no need to add more type parameters but just do an unchecked cast or raw type cast:
@SuppressWarnings("unchecked")
//...
return (Observable)lift(OperatorIgnoreElements.<T>instance());
Note that instance()
does this re-cast as well since the operator is stateless.
ah that's great @abersnaze, so simple! |
@@ -92,7 +92,7 @@ public void call(Integer t) { | |||
} | |||
}) | |||
// | |||
.ignoreElements() | |||
.<Integer>ignoreElements() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it prove this breaks the source compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it doesn't prove if it breaks binary compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to check binary compatibility as part of CI, there are some checker tools that we can include into the build process. Probably, it deserves a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I came across a semver for Java library awhile ago that could take two jars and hint if it was major, minor or patch change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized we don't have a guidance on source compatibility explicitly. We only discussed backward compatibility in #1917. But I'm supposed backward compatibility should include both binary and source backward compatibility.
So we need a decision on the importance of source compatibility specifically in the category of generic types, right? I'm happy to add a generic type to |
Could this changed be done in a minor release? |
closing in favor of #3567 |
to remove the need for mergeWithEmpty and concatWithEmpty in #3430. I'm pretty sure that this doesn't count as a breaking change because of type erasure.