Skip to content

Copy javax and jakarta @Qualifier onto generated AutoFactory params - #2123

Open
tanvir-ux wants to merge 1 commit into
google:mainfrom
tanvir-ux:fix-autofactory-qualifier-propagation
Open

Copy javax and jakarta @Qualifier onto generated AutoFactory params#2123
tanvir-ux wants to merge 1 commit into
google:mainfrom
tanvir-ux:fix-autofactory-qualifier-propagation

Conversation

@tanvir-ux

Copy link
Copy Markdown

Summary

  • AutoFactory 1.1.0 chooses jakarta.inject whenever it is on the classpath, and then treated an annotation as a qualifier only if it was meta-annotated with that API's @Qualifier.
  • Dagger / existing code still commonly uses javax.inject.Qualifier. Those annotations were dropped from generated factory constructors (Provider<Integer> instead of @MyQualifier Provider<Integer>), which is issue #1884.
  • Qualifier detection now accepts either javax.inject.Qualifier or jakarta.inject.Qualifier, independent of which package is used for generated @Inject / Provider.

Fixes #1884

Test plan

  • mvn test in factory/AutoFactoryProcessorTest 185 tests, 0 failures (new mixed javax/jakarta cases included)
  • mvn verify in factory/ — unit tests + invoker IT functional passed
  • Reviewer: compile an @AutoFactory class with @Provided @MyQualifier where @MyQualifier is javax.inject.Qualifier and both inject APIs are on the processor classpath; generated constructor should keep @MyQualifier on the Provider parameter

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
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

Successfully merging this pull request may close these issues.

[Regression] AutoFactory 1.1.0 no longer propagates @Qualifier

1 participant