-
Notifications
You must be signed in to change notification settings - Fork 14
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
Have a @Generated with Retention Class, in addition of Source on generated builder #28
Comments
Thank for opening the issue @alexandrenavarro. I think JaCoCo has multiple ways of excluding classes from coverage, right? Based on an annotation is just one of them. So you could do something like: <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>yourpackage/**/*Builder.class</exclude>
</excludes>
</configuration>
</plugin> And it should also work, right? |
Yes it works.
|
Can't you simply handle that case with the So, something like this: <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>yourpackage/**/*Builder.class</exclude>
</excludes>
<includes>
<include>yourpackage/ManualBuilder.class</include>
<!-- repeat as needed for all manually-written builders... -->
</includes>
</configuration>
</plugin> This way, the manually written classes will still be checked, but new classes using Jilt will be automatically excluded? |
Have a
@Generated
with Retention = Class, in addition of Source on generated builderIt would be great to have a
@Generated
annotation with@Retention(RetentionPolicy.CLASS)
in the generated builder like lombok@Generated
annotation in addition ofjavax.annotation.processing.Generated
with@Retention(RetentionPolicy.SOURCE)
because jacoco uses it in order not to check test coverage on the generated classes.I consider the builder should not be checked by jacoco as it is generated and because it should be tested by the generator itself in my opinion and today, in my project I tried to reach 100% of test coverage.
A potential solution is to let the user to configure extra annotation on the
@Builder
annotation on the builder generated class, like"extraAnnotationsOnBuilderClass" = "@lombok.Generated"
.Another solution is just to have a
@Generated
with@Retention(RetentionPolicy.CLASS)
in jilt and add add in the generator but this solution needs to have jilt not in maven scope provided but compile (personally, I like this solution less compared as the first one).Maybe there are some other solutions.
It is clearly a nice to have feature, not a blocking feature.
Thank you for your useful lib and don't hesitate if you have questions.
The text was updated successfully, but these errors were encountered: