Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used? 4.1.0
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Most clients use the following Generated
annotation for the autogenerated code. This is correct for Java 8 and below, see Java 8 Generated javadocs.
@javax.annotation.Generated(value = "org.openapitools...", date = "...")
Starting with Java 9, however, it is now under a new package name (added the "processing" sub-package). See the Java 9 Generated javadocs for more info.
@javax.annotation.processing.Generated(value = "org.openapitools...", date = "...")
The current native HttpClient Generated annotation template still uses the old package name, and so if you set hideGenerationTimestamp=false
, the code doesn't compile, since it runs in Java 11.
openapi-generator version
4.1.0
OpenAPI declaration file content or url
Any
Command line used for generation
Fails with all command lines that don't include hideGenerationTimestamp=true
.
Steps to reproduce
See above
Related issues/PRs
N/A
Suggest a fix
I have a PR coming up to fix this for the native HTTP clientlib. It creates the correct annotation for Java 9+ inside a custom generatedAnnotation.mustache
template inside the native resources directory.
Once more people start using Java 9+, a better alternative might be to have a Java 9
mode that would be incorporated into the shared generatedAnnotation.mustache
file. But for now, I think this quick fix is easier.
The samples don't have to be re-created since they don't have the Generated annotation.