SonarJava S1118 creates false positives when using Lombok

436 views
Skip to first unread message

Jens Bannmann

unread,
Apr 9, 2018, 4:34:31 AM4/9/18
to SonarQube
Hi all!

When you write no constructor, but use one or more of Lombok's constructor annotations, the compiler will not add an implicit one. However, S1118 ("Utility classes should not have public constructors") raises an issue about this. We use SonarJava on SonarCloud.

We would like to keep the rule active yet avoid having to deal with all these false positives manually.

Note that for another Lombok annotation, @UtilityClass, which generates a private no-arg constructor, S1118 does not trigger a false positive.

Best regards,
Jens Bannmann

Jens Bannmann

unread,
May 22, 2018, 8:33:59 AM5/22/18
to SonarQube
Here's a pull request fixing the false positives: https://github.com/SonarSource/sonar-java/pull/2027

Best regards,
Jens Bannmann

Michael Gumowski

unread,
Jun 8, 2018, 4:16:38 AM6/8/18
to Jens Bannmann, SonarQube
Hello Jens,

Thanks for the feedback and the PR. I'm going to review it and communicate to you from there.

Cheers,
Michael

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/819b77df-6d47-44b0-aff7-a7192bbc5def%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Michael Gumowski | SonarSource
Software Developer, Language Team
https://www.sonarsource.com
Reply all
Reply to author
Forward
0 new messages