Copy javax and jakarta @Qualifier onto generated AutoFactory params - #2123
Open
tanvir-ux wants to merge 1 commit into
Open
Copy javax and jakarta @Qualifier onto generated AutoFactory params#2123tanvir-ux wants to merge 1 commit into
tanvir-ux wants to merge 1 commit into
Conversation
When both inject APIs are on the classpath, AutoFactory generates jakarta.inject types but still must treat javax.inject.Qualifier as a qualifier so @provided parameters keep their annotations. Fixes google#1884
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jakarta.injectwhenever it is on the classpath, and then treated an annotation as a qualifier only if it was meta-annotated with that API's@Qualifier.javax.inject.Qualifier. Those annotations were dropped from generated factory constructors (Provider<Integer>instead of@MyQualifier Provider<Integer>), which is issue #1884.javax.inject.Qualifierorjakarta.inject.Qualifier, independent of which package is used for generated@Inject/Provider.Fixes #1884
Test plan
mvn testinfactory/—AutoFactoryProcessorTest185 tests, 0 failures (new mixed javax/jakarta cases included)mvn verifyinfactory/— unit tests + invoker ITfunctionalpassed@AutoFactoryclass with@Provided @MyQualifierwhere@MyQualifierisjavax.inject.Qualifierand both inject APIs are on the processor classpath; generated constructor should keep@MyQualifieron theProviderparameter