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

Change default value of <generatedAnnotation/> to "false" #9732

Closed
lukaseder opened this issue Jan 15, 2020 · 4 comments
Closed

Change default value of <generatedAnnotation/> to "false" #9732

lukaseder opened this issue Jan 15, 2020 · 4 comments

Comments

@lukaseder
Copy link
Member

Generated code, by default, contains a javax.annotation.Generated (Java 8 and less) or javax.annotation.processing.Generated (Java 9+) annotation, which contains a bit of information about:

  • The fact that jOOQ generated the class
  • The jOOQ version that generated the class
  • The catalog and schema version if provided by relevant SPIs
  • The timestamp of code generation

While the catalog and schema versions can be useful to prevent re-generation of generated code when the underlying schema version has not changed (e.g. provided by Flyway), the code generation timestamp in particular is quite annoying when generated code is being checked in. It also prevents incremental compilation for no good reason, as file content will always have changed because of this timestamp, even if the rest of the file remains untouched.

The presence of schema version provider or catalog version provider configurations will continue to enforce the generated annotation, so user code will probably not break, unless users wrote their own annotation processing.

@ZhorzhRaychev
Copy link

Sorry to dig this out, just a quick question. I'm updating the jooq version and noticed that @generated was gone. That lead me to seeing its default is now "false".
From what I see here, the reason was the annoying timestamp and I had similar issues before using another code gen tool(dagger). However I don't see any timestamps currenty:
@Generated( value = { "https://www.jooq.org", "jOOQ version:3.14.15" }, comments = "This class is generated by jOOQ" )
so I was wondering, am I missing something?

@lukaseder
Copy link
Member Author

See the example from the manual:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-generate/codegen-generate-annotations/

<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.16.5.xsd">
  <generator>
    <generate>
      <generatedAnnotation>true</generatedAnnotation>
      <generatedAnnotationType>DETECT_FROM_JDK</generatedAnnotationType>
      <!-- This: -->
      <generatedAnnotationDate>true</generatedAnnotationDate>
      ...

@ZhorzhRaychev
Copy link

ZhorzhRaychev commented Apr 11, 2022

I see it is being set to true?

I'm trying to understand better the problem with timestamps that led to the default being changed

P.S. Thanks for answering so quickly!

@ZhorzhRaychev
Copy link

Ahh maybe that's the reason:

generatedAnnotationDate = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants