-
Notifications
You must be signed in to change notification settings - Fork 21
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
Honor @uncheckedVariance in type alias #8795
Labels
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8795?orig=1 |
@retronym said: |
@retronym said: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In akka-stream we use reactive-stream Publisher and Subscriber interfaces, which are implemented in Java. At several places we had to add uncheckedVariance annotation. A suggestion by @retronym was to define those in a type alias instead.
It turns out that the type alias is expanded and the uncheckedVariance annotation is not used.
Discussion and example that illustrates the problem can be found here: akka/akka#15643
[edit] Reproducing the example here:
Indeed, variance validation seems to dealias, which thwarts the attempt to indirect through an unchecked alias.
Contrast with:
I'm not sure whether or not subclassing or using a upper bounded type declaration would work for your use case.
The text was updated successfully, but these errors were encountered: