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

gRPC generated java references javax.annotation.Generated which is not in Jakarta #23922

Open
hutchig opened this issue Jan 16, 2023 · 5 comments
Assignees

Comments

@hutchig
Copy link
Contributor

hutchig commented Jan 16, 2023

gRPC protobuf tools generate Java that has annotations that are NOT retained at runtime of
javax.annotation.Generated

Such java will not compile with Liberty in Jakarta 9/10 as that package is not present.
There are 2 possible solutions currently:
1 - Use the Eclipse transformer (The Liberty gRPC 1.0 guide stopped short of including this for simplicity's sake.)

2 - Add in a dependency, for example the gRPC read.me recommends:

grpc/grpc-java#9179 (comment)

<dependency> <!-- necessary for Java 9+ -->
  <groupId>org.apache.tomcat</groupId>
  <artifactId>annotations-api</artifactId>
  <version>6.0.53</version>
  <scope>provided</scope>
</dependency>

(The Liberty gRPC guide ++ looks like it wants to use that route:
OpenLiberty/guide-grpc-intro#43 )

  1. As it's an annotation that is not retained at RUNTIME could we not bundle it up and pull it in
    to the compile dependencies IFF gRPC and Jakarta EE9/10... etc is the mode?
    After all tomcat are bundling it without 'owning' the javax.annotation package so we should
    be able do the same in a way that avoids it being on the compile classpath if NOT Jakarta?
@hutchig hutchig self-assigned this Jan 16, 2023
@hutchig
Copy link
Contributor Author

hutchig commented Jan 16, 2023

The actions/questions here are:
1:
Do we want to ship a guide that has to make use of Tomcat to compile?

2:
If we can find a way for the grpc generated code to 'just work' can we
(can I have the green light to) create a small PR that bundles the javax Generated
annotation as part of gRPC for Jakarata compile path?

I would think we would want to be careful NOT to ship javax.annotations.Generated if
the user was getting it from the pre-Jakarta source but as it is not retained at runtime
I am not sure exactly how careful we would really need to be.

@hutchig
Copy link
Contributor Author

hutchig commented Jan 24, 2023

https://search.maven.org/artifact/javax.annotation/javax.annotation-api/1.3.2/jar
might be an alternative source of the annotation.

@hutchig
Copy link
Contributor Author

hutchig commented Feb 13, 2023

The grpc guide has been changed to pull in the javax package without doing so via tomcat, so this is no longer an urgent design issue. I will see if I can include the same include they use ONLY if we are in Jakarta mode as part of the base feature.

@cbridgha
Copy link
Member

cbridgha commented Mar 7, 2023

I put this in parked for now - please let me know if status changes...

@hutchig
Copy link
Contributor Author

hutchig commented Mar 17, 2023

There are two follow on actions for this:
1 - see if I can include the https://search.maven.org/artifact/javax.annotation/javax.annotation-api/1.3.2/jar if we are in the Jakarta mode and @Generated would not be present otherwise
2 - Write a PR on the grpc readme to replace references to Tomcat with javac.annotation-api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Parked
Development

No branches or pull requests

2 participants