I am preparing a big migration to JAVA8. Part of it configures checkstyle to work correctly with JAVA8 constructs. I am trying to keep checkstyle synchronized with the default autoformatting tool in IntelliJ. Unfortunately, it does not accept IntelliJ automatic indentation of lambda expressions.
checkstyle.xml
<module name="Indentation">
<property name="caseIndent" value="0"/>
</module>
code:
public class Java8CheckstyleTest {
public void java8Elements(String ala) {
Collections.sort(names, (String a, String b) -> {
return b.compareTo(a);
});
}
}
Verification Report:
Java8CheckstyleTest.java:25: the block child has an incorrect indentation level 12, the expected level should be 16.
Java8CheckstyleTest.java:26: "block rcurly" has the wrong indentation level 16, the expected level should be 12.
If I break "})" with a new line and autoformat:
public class Java8CheckstyleTest {
public void java8Elements(String ala) {
Collections.sort(names, (String a, String b) -> {
return b.compareTo(a);
}
);
}
}
I get:
Java8CheckstyleTest.java:25: the block child has the wrong indentation level 20, the expected level should be 16.
Java8CheckstyleTest.java:26:'block rcurly ' 16, 12.
checkstyle, ?
EDIT: checkstyle 6.11.1, , , . . :
Java8CheckstyleTest.java:32: : "block" 20, : 12, 16.
Java8CheckstyleTest.java:33: : "block rcurly" 16, : 8, 12.
, , , , ββ IntelliJ. .