Closed
Description
The SpringLambdaCheck
throws the following exception if the source code contains a switch
expression:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (default-cli) on project spring-javaformat-maven-sample: Failed during checkstyle configuration: Exception was thrown while processing /home/reichardt/Projects/_github/SpringLambdaCheck-with-switch-expression/src/main/java/sample/SampleApplication.java: Cannot invoke "com.puppycrawl.tools.checkstyle.api.DetailAST.getChildCount(int)" because "ast" is null -> [Help 1]
Example switch expression:
String message = switch (args.length) {
case 0 -> "No arg";
case 1 -> "One arg";
default -> getText.apply(args.length);
};
Used versions:
- Java: 16
- spring-javaformat: 0.0.29
- maven-checkstyle-plugin: 3.1.2
- checkstyle: 9.0.1
Minimal demo application: https://github.com/Josef-Reichardt/SpringLambdaCheck-with-switch-expression