-
Notifications
You must be signed in to change notification settings - Fork 115
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 @Generated annotation on generated code #763
Conversation
I bet Maven tests will not pass. |
ac227fd
to
f0f8b7d
Compare
f1afb4d
to
0c2dd8a
Compare
https://mvnrepository.com/artifact/javax.annotation/jsr250-api indicates that this artifact has moved to javax.annotation » javax.annotation-api
0c2dd8a
to
1ec86d8
Compare
To be honest, seeing the impact it has just on our examples and testing infrastructure, I don't think any more that adding Would it make sense to provide it as an option instead? I haven't checked the placement, so this might not work, but could it actually even just go at the end of the user header code as a user-provided annotation? |
One of the fall through comments has a typo:
(Might it explain the Error Prone errors that were still happening? #222 (comment)) Why not add the warning suppression to the generated methods (e.g. |
Oh, well spotted! That is indeed worth investigating. |
Maybe I'm missing something, but why is |
The generated method also contains user code, for which you might want the warning. |
I agree with that. |
I thought the idea was to suppress them anyway since it is/was being added to the whole class, but that's a good reason not to. |
Yes, this PR removes the Even though I agree that this is impactful for existing projects, I think it is the proper fix. |
@regisd adding |
Thank you Patrick. Indeed, I wasn’t aware of this change. More details in
the use of Generated in gRoc.
grpc/grpc-java#6833
Le mar. 15 déc. 2020 à 10:35, Patrick Reinhart <[email protected]> a
écrit :
@regisd <https://github.com/regisd> adding @generated should be handeld
with care as due to the transaction of JavaEE to JakartaEE the import will
change from javax.annotation.Generated to jakarta.annotation.Generated
that has to taken into account though.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#763 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGMVVHEJCYNHRQ3LQO3HJTSU4UUXANCNFSM4M7CJ6JQ>
.
--
Régis Décamps
http://regis.decamps.info/
|
4c48206
to
c744e95
Compare
At the same time, the existing |
@regisd the problem is that adding this annotation is not future prove, as the package will change in the future (a major breaking change on the JakarteEE side due to the transition from Oracle to the Eclipse Foundation, the Eclipse guys had to change the namespace). I would prefer to add this annotation by the end user itself not by the generation in the first place, so that I'm able to switch the annotation import as soon as I will need it. Also adding the annotation dependency will break my code in case I want to stay on the old namespace a longer if my customers or other dependencies require it... |
Isn't javax.annotation.processing.Generated (which is added in Java 11) the future-proof version? |
9c650dd
to
16e4d52
Compare
If you use |
@Generated
Fix Add @Generated on generated code #453With this change, all users of JFlex need to hava
javax.Generated
in their classpath, for instance by adding a dependency onhttps://search.maven.org/artifact/javax.annotation/javax.annotation-api/1.3.2/jar
@SuppressWarnings
Fix Allow custom @SuppressWarnings in JFlex 1.8.2 #762