-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow Kotlin Collections.List for @All qualifier #24766
Comments
/cc @evanchooly |
It's not a bug but a problem caused by the fact that kotlin translates |
Ok, but what is different for the MutableList? Is this a bug in Kotlin or wanted? |
I have found this older ticket, stating to keep it as it is: https://youtrack.jetbrains.com/issue/KT-5792 |
I don't think it's a bug in Kotlin. The point is that Kotlin's @Ladicek and @evanchooly might have a better explanation ;-). |
Right. Kotlin's On the other hand, Kotlin's Technically, I think we could make a special case for this situation, but I'll leave that decision up to @mkouba. |
Like relax the spec requirements for an injetion point type in this particular case? I'm not a big fan of similar things. |
I'm not sure how to achieve it but a special case for this situation would be greatly appreciated; every time I use |
I don't know how complex it is, but would it be possible to add a Kotlin compiler plugin (or something quarkus specific), which fixes such particular places? Also, a mention in the docs somewhere that this is a problem would be helpful to reduce and avoid this pitfall. |
The best we can do without having to go to great lengths is provide an actionable error message |
Hm, kotlin classes are annotated with a special annotation, right? |
Yes, Kotlin-generated classes have the |
- resolves quarkusio#24766 (cherry picked from commit 0e01070)
Describe the bug
I was trying to inject different implementations of the same interface at the same time. Following the docs I have done it with:
But on compilation it throws:
As I am using Kotlin, I changed the type of the list to
MutableList
, which works.I think
List
is the more appropriate type following the docs:The injected instance is an immutable list of the contextual references of the disambiguated beans.
. So either both or onlyList
should be supported. The later one could break existing code.I am also unsure, if the wildcard exception is the correct exception in this case?
Expected behavior
An immutable list is injected for
List<T>
.Actual behavior
An exception is thrown.
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.8.0.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)mvn
Additional information
No response
The text was updated successfully, but these errors were encountered: