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

Allow typed injection in Kotlin without @JvmSuppressWildcards #2586

Open
matejdro opened this issue May 4, 2021 · 4 comments
Open

Allow typed injection in Kotlin without @JvmSuppressWildcards #2586

matejdro opened this issue May 4, 2021 · 4 comments

Comments

@matejdro
Copy link

matejdro commented May 4, 2021

As per #900 (comment)

Most other Kotlin issues have been resolved (such as object modules requiring @JvmStatic). Is there any chance that this issue is solved too?

Workaround is pretty ugly, especially because it is pretty long and using it forces us to split declarations of injected types into multiple lines.

@matejdro matejdro changed the title Allow injection in Kotlin without @JvmSuppressWildcards Allow typed injection in Kotlin without @JvmSuppressWildcards May 4, 2021
@Chang-Eric
Copy link
Member

This is something on our list to address, but unfortunately we probably can't do full support in the sense of merging the key space for all parameterized keys due to the way it breaks backwards compatibility, complications with nested types, and complications with bidirectional support (e.g. intuitively we want to make Set<? extends Foo> and Set<Foo> be the same, but you can't actually assign a Set<? extends Foo> to a Set<Foo>.)

Our current plan is to improve the error message with a suggestion of the similar keys if they exist in the binding graph as well as probably doing the same thing as Guice did in google/guice#1366 to make this easier with multibindings.

@yschimke
Copy link

+1 to improving the error message, that would have saved me a lot of time.

@yschimke
Copy link

Also seems like a nice addition to https://dagger.dev/dev-guide/multibindings.html and any best practice docs.

@matejdro
Copy link
Author

It looks like this will be solved as part of the KSP migration: #2349 (comment)

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

No branches or pull requests

3 participants