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

Generated Java source should be annotated with @Generated #2513

Closed
dimo414 opened this issue Dec 16, 2016 · 1 comment
Closed

Generated Java source should be annotated with @Generated #2513

dimo414 opened this issue Dec 16, 2016 · 1 comment
Assignees

Comments

@dimo414
Copy link
Contributor

dimo414 commented Dec 16, 2016

Generated Java source code should be annotated with @Generated to aid static analysis and tooling. For example Error-Prone will ignore errors in @Generated code.

As a workaround presently I have a pre-compilation step that adds the annotation manually, but ideally the protoc compiler would do this for me.

<!-- based on http://stackoverflow.com/a/5941279/113632 -->
<replaceregexp match="public(.*) class" replace="@javax.annotation.Generated(&quot;protoc&quot;) \0">
  <fileset dir="${proto.src}" includes="**/*.java" />
</replaceregexp>
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

5 participants