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

Optional alternative to javax.inject #2721

Closed
overheadhunter opened this issue Jun 24, 2021 · 2 comments
Closed

Optional alternative to javax.inject #2721

overheadhunter opened this issue Jun 24, 2021 · 2 comments

Comments

@overheadhunter
Copy link

overheadhunter commented Jun 24, 2021

As per spec, Dagger is

allowing null by annotating the method with any @Nullable annotation like javax.annotation.Nullable or androidx.annotation.Nullable.


Now I'm wondering, if the same behaviour would be feasible for @Inject, @Named, ... annotation as well?

The reason why I'm proposing this change is simply, because we can not expect javax.inject to declare an automatic module name any time soon. This effectively stops Dagger users from publishing named modules without relying on a filename-based module name for javax.inject.

If Dagger accepted these annotations from any package, users could exclude the javax.inject dependency and use e.g. jakarta.inject instead.

javax.inject could still remain the default dependency, so this change wouldn't break anything. But it would add some flexibility when dealing with the module system.

@Chang-Eric
Copy link
Member

I don't think we can do the same thing for @Inject as we did for @Nullable easily since the difference is we actually trigger our annotation processing off of the @Inject annotation. We do intend to support jakarta.inject though (#2058 is open for that) so hopefully that will solve your needs that way.

@overheadhunter
Copy link
Author

Yes, that would solve the issue as well. 👍

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

No branches or pull requests

2 participants