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

Remove javax.annotation:javax.annotation-api #54

Merged
merged 4 commits into from
Jun 30, 2024

Conversation

DanielLiu1123
Copy link
Owner

@DanielLiu1123 DanielLiu1123 commented Jun 30, 2024

Because of historical reasons, grpc-generated Java classes have the javax.annotation.Generated annotation. This annotation was part of JDK, but after JDK 9, it moved to javax.annotation:javax.annotation-api (Java EE, now called Jakarta EE). So, if the JDK version is higher than 9, you need to manually add javax.annotation:javax.annotation-api to fix this problem. Now, Java EE has become Jakarta EE, and the package name has changed to jakarta. Many libraries have moved from javax to jakarta, but it seems this is not the goal for the grpc-java library (see grpc/grpc-java#9179). So, if you use grpc with other libraries (like Spring Boot), you will find two Generated annotations, one in the javax package and one in the jakarta package. This can be very confusing, especially for people who do not know this history well, and they might use the wrong annotation from the javax package.

grpc 1.64 provides a @generated=omit option to configure whether the generated code includes the javax.annotation.Generated annotation, removing the need for the javax.annotation:javax.annotation-api dependency.

To prevent both javax and jakarta package Generated annotations from appearing on the classpath, grpc-starter will remove the javax.annotation:javax.annotation-api dependency. Users can manually add this dependency or use the @generated=omit option when generating code.

Close #53

@DanielLiu1123 DanielLiu1123 merged commit 095870c into main Jun 30, 2024
1 check passed
@DanielLiu1123 DanielLiu1123 deleted the feat-delete-javax-annotation branch June 30, 2024 04:54
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.

Remove javax.annotation:javax.annotation-api
1 participant