Checkstyle issuing an indentation warning on an annotation?
checkstyle, java
Solution
It's a known issue in checkstyle: github.com/checkstyle/checkstyle/issues/553
As a workaround you can set lineWrappingIndentation property to zero:
<module name="Indentation">
<property name="lineWrappingIndentation" value="0"/>
</module>
But in this case you will also need to remove extra indentations after line breaks, e.g.
return getCalculator().
calculate(...);
instead of
return getCalculator().
calculate(...);
Problem
I have an annotation like: ``` @ComponentScan( basePackages = { "com.example.foo", "com.example.bar" } // <--- false positive reported in this line ) public class FooBar extends WebMvcConfigurerAdapter { ... } ``` And a Checkstyle configuration of: ``` <module name="AnnotationUseStyle" /> <module name="Indentation"> <property name="basicOffset" value="2" /> <property name="braceAdjustment" value="0" /> <property name="caseIndent" value="2" /> </module> ``` When I run my project through Checkstyle, I get an error stating "assign child at indentation level 2 not at correct indentation, 4". This is referencing line 5 of my code example above, i.e. the closing parenthetical for the `basePackages` property. What configuration change to Checkstyle would I need to make for this annotation to validate correctly?