java:S1228 does not merge packages of generated sources

The rule java:S1228 Packages should have a javadoc file ‘’ does not work for generated sources.
We include generated sources in sonar analysis and then you get a false positive for every package in ‘target/generated-sources/annotations/’

So we have a in src/main/java/com/foo
But it complains that one is missing in target/generated-sources/annotations/com/foo

Kind regards,

The implementation of the rule S1228 does not support several source directories, it’s a bug. Ticket created SONARJAVA-3369. Meanwhile, you should mark issues as false-positive or disable this rule on this project.
Thanks for your feedback,

I retested it and it is fixed, but now I get a new violation by java:S4032. which seems to ignore that the package only contains generated sources. Curiously this only is flagged for 1 package, but I have two packages that only contain generated sources except the

To sum up, the situation is:

  • you have a in src/main/java/com/foo. the folder contains only this file.
  • you have generated file in, let’s say: target/generated-sources/annotations/com/foo.

S4032 raises an issue, but is wrong since this is actually needed by the generated files.

Am I understanding the situation correctly?

Hi Quentin,

yes your understanding is correctly. The curious part is that I have two packages that fit to this description, but only one is flagged with S4032.

Kind regards,

Thanks for the confirmation. Ticket created: SONARJAVA-3633.

In addition, this is indeed strange that you don’t have an issue with both, but since we will probably have to rework this rule completely, we should not bother too much to understand the exact reason.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.