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 scoping issue #103

Open
ghulands opened this issue May 8, 2022 · 2 comments
Open

Generated scoping issue #103

ghulands opened this issue May 8, 2022 · 2 comments

Comments

@ghulands
Copy link

ghulands commented May 8, 2022

When using generating JAXB classes using the latest xjc with the -mark-generated argument, it generates the classes with the jakarta.annotation.Generated annotation. I have the generated sources in the build folder, but also have sources in the same package as what xjc generates to, so when using Jacoco I can't exclude solely based on package name. Jacoco can automatically exclude a class from reports if it has a @generated annotation. Because the current scoping of the annotation is to SOURCE, jacoco doesn't see it and thus includes the classes in the report.

I'll submit a PR, but thought I would create the issue as well for any discussion.

@christianhujer
Copy link

I second this. It would be great if the Retention would be changed to Runtime. That something is generated isn't just useful information for the source code itself, but also for the byte code and at runtime. And it's a bit of a bummer that the two provided annotations javax.annotations.Generated and jakarta.annotations.Generated can't be used in situations where this type of information is required at runtime.

@xenoterracide
Copy link

The same problem exists for spotbugs (comments in thread on related issue (yes they're mentioning javax, but still))

spotbugs/spotbugs#1385 (comment)

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

No branches or pull requests

3 participants