In a Spring Java project I have the following class:
@SuppressWarnings({"PMD", "Checkstyle"}) @SpringBootApplication public class ToolBoxApplication { public static void main(final String[] args) { SpringApplication.run(ToolBoxApplication.class, args); } }
Building using Jenkins tells me that I should not have a public or default constructor in a utility class.
In my checkstyle.xml withing Treewalker file I have
<!-- Make the @SuppressWarnings annotations available to Checkstyle --> <module name="SuppressWarningsHolder" />
And the module
I tried to supress the specific check using
@SuppressWarnings({“PMD”, “checkstyle:HideUtilityClassConstructor”})
but this did not work either. The “PMD” supression does work (it effectively reports the same error).
Advertisement
Answer
You need to specify checkstyle name in lower case when supressing. This will do
@SuppressWarnings({"PMD", "checkstyle:hideutilityclassconstructor"})