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

Annotate generated classes with @Generated #2081

Closed
thomasdarimont opened this issue Sep 13, 2017 · 3 comments
Closed

Annotate generated classes with @Generated #2081

thomasdarimont opened this issue Sep 13, 2017 · 3 comments

Comments

@thomasdarimont
Copy link

thomasdarimont commented Sep 13, 2017

Generated classes like CheckedFunction0 could be annotated with javax.annotation.Generated to differentiate them from hand written code.

Furthermore the generator class as well as the actual generator method could be referenced via the comment attribute to ease finding the appropriate generator method.

@danieldietrich
Copy link
Contributor

danieldietrich commented Sep 13, 2017

Hi Thomas,

thank you for your suggestion! Could you please elaborate on the use-case(s)?

Currently we ensure that PRs will fail when generated code is manually modified. Our CI build does this by...

  1. performing a git clone (which may contain manually modified generated code)
  2. running the build (which overwrites generated code)
  3. checking for changes using git status (there shouldn't be changes)

By using annotations, we make the 'is generated' property part of the public API. Our users should not bother whether source is generated or not. We need the freedom to change that property without affecting backward-compatibility.

I'm looking forward to learn about your use-case.

@danieldietrich danieldietrich added this to the vavr-1.0.0 milestone Sep 13, 2017
@danieldietrich danieldietrich removed this from the vavr-1.0.0 milestone Sep 13, 2017
@danieldietrich
Copy link
Contributor

Maybe this might come handy when we use an 'inline code generator' (see Seamlessly fuse hand-written and generated code)

@danieldietrich
Copy link
Contributor

I just saw that @Generated has the retention policy 'SOURCE' - now I understand that the use-case you meant is documentation. So, let's do it!

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

No branches or pull requests

2 participants