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

add option to generate jakarta @Inject in generated factory #1184

Closed
h908714124 opened this issue Oct 17, 2021 · 4 comments
Closed

add option to generate jakarta @Inject in generated factory #1184

h908714124 opened this issue Oct 17, 2021 · 4 comments

Comments

@h908714124
Copy link

h908714124 commented Oct 17, 2021

Currently, the classes generated from @AutoFactory will have a javax.inject.Inject annotation, which makes them incompatible with tools that use jakarta annotations. Please add some option, or alternative annotation, so users can choose to have a jakarta.inject.Inject annotation in the generated code instead.

@eamonnmcmanus
Copy link
Member

Could you say some more about these tools? javax.inject.Inject has been the standard since JSR 330 was finalized in 2009. It seems surprising that tools would not understand it.

@eamonnmcmanus
Copy link
Member

Closing due to lack of response.

@anuragagarwal561994
Copy link

@eamonnmcmanus this issue should be opened again, the standards have changed and even guice has now adopted to produce jakarta annotations in their latest versions 7.x and 6.x

Tomcat 10.x has also migrated to jakarta annotations as it has been finalised it to be the standard.

@eamonnmcmanus eamonnmcmanus reopened this May 15, 2023
@eamonnmcmanus
Copy link
Member

Agreed, with Guice moving to jakarta.* we should support this at least optionally.

@eamonnmcmanus eamonnmcmanus self-assigned this May 15, 2023
copybara-service bot pushed a commit that referenced this issue Jun 6, 2023
Previously AutoFactory recognized and generated `javax.inject` only. Now, it will continue to do so if `javax.inject` is present on the classpath, but it will recognize `jakarta.inject` if only that is on the classpath.

Also remove some obsolete tests that would otherwise have had to be updated.

Closes #1184.

RELNOTES=AutoFactory now recognizes and generates both `javax.inject` and `jakarta.inject`. If `jakarta.inject` is on the classpath then it will be used, and otherwise `javax.inject`. A new compiler option `-Acom.google.auto.factory.InjectApi` can be set to either `javax` or `jakarta` to force the use of one or the other.
PiperOrigin-RevId: 535324709
copybara-service bot pushed a commit that referenced this issue Oct 23, 2023
Previously AutoFactory recognized and generated `javax.inject` only. Now, it will prefer `jakarta.inject` if that is on the classpath, but it will still recognize `javax.inject` if only that is on the classpath. A new compiler option can be used to select `javax.inject` even if `jakarta.inject` is also available.

Also remove some obsolete tests that would otherwise have had to be updated.

Closes #1184.

RELNOTES=AutoFactory now recognizes and generates both `javax.inject` and `jakarta.inject`. If `jakarta.inject` is on the classpath then it will be used, and otherwise `javax.inject`. A new compiler option `-Acom.google.auto.factory.InjectApi` can be set to either `javax` or `jakarta` to force the use of one or the other.
PiperOrigin-RevId: 535324709
copybara-service bot pushed a commit that referenced this issue Oct 23, 2023
Previously AutoFactory recognized and generated `javax.inject` only. Now, it will prefer `jakarta.inject` if that is on the classpath, but it will still recognize `javax.inject` if only that is on the classpath. A new compiler option can be used to select `javax.inject` even if `jakarta.inject` is also available.

Also remove some obsolete tests that would otherwise have had to be updated.

Closes #1184.

RELNOTES=AutoFactory now recognizes and generates both `javax.inject` and `jakarta.inject`. If `jakarta.inject` is on the classpath then it will be used, and otherwise `javax.inject`. A new compiler option `-Acom.google.auto.factory.InjectApi` can be set to either `javax` or `jakarta` to force the use of one or the other.
PiperOrigin-RevId: 535324709
copybara-service bot pushed a commit that referenced this issue Oct 23, 2023
Previously AutoFactory recognized and generated `javax.inject` only. Now, it will prefer `jakarta.inject` if that is on the classpath, but it will still recognize `javax.inject` if only that is on the classpath. A new compiler option can be used to select `javax.inject` even if `jakarta.inject` is also available.

Also remove some obsolete tests that would otherwise have had to be updated.

Closes #1184.

RELNOTES=AutoFactory now recognizes and generates both `javax.inject` and `jakarta.inject`. If `jakarta.inject` is on the classpath then it will be used, and otherwise `javax.inject`. A new compiler option `-Acom.google.auto.factory.InjectApi` can be set to either `javax` or `jakarta` to force the use of one or the other.
PiperOrigin-RevId: 535324709
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants