-
Notifications
You must be signed in to change notification settings - Fork 89
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
Allow custom annotations on generated class files #116
Comments
I just noticed that I did not write which solution I prefer. I would be in favor Solution 1 (Rocker provides its own annotation) where Rocker provides the annotation in its runtime. |
The rocker/rocker-compiler/src/main/java/com/fizzed/rocker/compiler/JavaGenerator.java Line 203 in 28510d4
I'm sure a PR would be accepted if you opened it. |
A rocker provided custom Generated annotation sounds like a great
solution. Add the annotation to the runtime module and have the generator
add it. I'm not sure there's any downside to adding it by default -- if
there was then a config option to disable including it would be useful.
…On Thu, Aug 1, 2019 at 8:33 AM bendem ***@***.***> wrote:
The @javax.annotation.Generated option was added a while ago
<#59> and subsequently removed
because it is part of a broken jigsaw module
<#82>. If you wanted to add it back
(not using the javax annotation but a custom rocker one), you would add it
here:
https://github.com/fizzed/rocker/blob/28510d469a563f92daba3bfb7908c94c6bd5a143/rocker-compiler/src/main/java/com/fizzed/rocker/compiler/JavaGenerator.java#L203
I'm sure a PR would be accepted if you opened it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#116?email_source=notifications&email_token=AAEPAAS6NHYBYZ6AYFFAKD3QCLJ2XA5CNFSM4IFVM7GKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3KN4CQ#issuecomment-517266954>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEPAAVQCNX3572OLRB6BOLQCLJ2XANCNFSM4IFVM7GA>
.
|
Mark generated classes as generated #116
I am using jacoco to measure the test coverage in my projects.
Jacoco excludes classes from analysis that have a
@Generated
annotation with a retention of at leastCLASS
. The package of the annotation does not matter. Just the name and the retention.I suggest that we add the possibility to annotate classes generated by rocker like this.
I see the following three options:
Rocker provides its own annotation
Create an
@com.fizzed.rocker.Generated
annotation and add that to all generated classes.The user already has to include a rocker runtime dependency. Alternatively rocker could emit the source for the annotation as part of it's source generation.
Rocker uses an established annotation
Rocker could provide support for some established
@Generated
annotations. AFAIK there are none. Rocker could also try some fancy classpath scanning and search for@Generated
annotations.Rocker provides a facillity to let the user provide its own Annotation(s)
Rocker could provide the user with an option to let them specify (a list) of annotations to add. This way each project could provide its own
@Generated
annotation or reuse a third party@Generated
annotation if they so desire.@jjlauer and others,
what do you think? I would be willing to work on a PR. Which option do you prefer?
Edit:
I tried to add my own
@Generated
annotation via post-processing. Sadly the template model does not seem to expose the possibility to add annotations.The text was updated successfully, but these errors were encountered: