-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Use javax.annotation.processing.Generated for Java 11 native client #3637
Conversation
Before Java 9, the `Generated` annotation was part of JEE and in the `javax.annotation` package. Starting with Java 9, it is now part of the standard SDK, under the new `javax.annotation.processing` package. This change creates a custom Generated annotation template for the native clientlib, since it is guaranteed to be run in Java 11+.
CC @cbornet @jeff9finger @karismann @Zomzog Java technical committee @macjohnny as reviewer of #3434 that introduced this new generator. This is meant to address bug #3636 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@bbdouglas where/how is this file included/referenced? |
This is with usage of But you are right, when this construct is used, inside
Then I think that So I guess this PR does not really work. |
@macjohnny @jmini As you rightly pointed out, this is referenced in I remember looking this up before, and there is a hierarchy of file locations that are searched when looking for a mustache file. First it tries the library directory, and if it doesn't exist there, it backs off to the general Java directory. That's how I can have my own custom |
The place I know is: Line 153 in 2d7785a
But I thought this is not used when a template calls an other template. |
@bbdouglas thanks for the PR, which has been included in the v4.1.1 release: https://twitter.com/oas_generator/status/1165944867391860737 |
Does this issue still exist? I have tried plugin versions 4.2.2 and 4.1.3 and keep getting javax.annotation.Generated in my gen'd server stubs. Was the solution not carried over to versions beyond 4.1.1 or something? Perhaps I'm not using the solution correctly, like maybe missing a config option? Edit: I see now that I just need to specify the hideGenerationTimestamp=true in my configOptions. Disregard my comment :) |
Still not clear how to use it. When I add
, no Can you please explain how to set up the custom annotation? AFAIU, I have to somehow override |
Before Java 9, the
Generated
annotation was part of JEE and in thejavax.annotation
package. Starting with Java 9, it is now partof the standard SDK, under the new
javax.annotation.processing
package.
This change creates a custom Generated annotation template for the
native clientlib, since it is guaranteed to be run in Java 11+.
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master
,4.1.x
,5.0.x
. Default:master
.Description of the PR
Adds a new custom
generatedAnnotation.mustache
template for the native HttpClient library with the correctGenerated
package name for Java 9+.Fixes #3636