Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3636
Closed
Open
Issue created Aug 13, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Java][native] Wrong `Generated` annotation package for Java 9+

Created by: bbdouglas

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.

Assignee
Assign to
Time tracking