/var/tmp $ javac Test.java:
/var/tmp $ cat Test.java:
$ cat Test.java
import java.util.function.BiFunction;
/**
* A test class to highlight a violation issue.
*/
public class Test {
/**
* A lambda, for the purpose of illustrating the issue.
*/
private static final BiFunction<String,String,String> FUNCTION = (a,b) -> { // Violation -- no space after comma
return "Hello World, " + a + " and " + b;
};
/**
* Entry point of the application.
*/
public static void main(String [] args) {
final Test test = new Test();
test.doSomething("Lucy","Ricky");
}
/**
* Runs the lambda.
*/
public void doSomething(final String arg1,final String arg2) { // Violation -- no space after comma
System.out.println(FUNCTION.apply(arg1,arg2)); // Violation -- no space after comma
}
}
/var/tmp $ cat config.xml:
(We're using Google Style at this commit: https://github.com/checkstyle/checkstyle/blob/60f41e3c16e6c94b0bf8c2e5e4b4accf4ad394ab/src/main/resources/google_checks.xml).
/var/tmp $ java -Duser.language=en -Duser.country=US -jar checkstyle-8.8-all.jar -c config.xml Test.java:
Starting audit...
Audit done.
According to section 4.6.2 of the official Google Style Guide, item 5 indicates that "a single ASCII space" should appear after commas, colons, semicolons, "or the closing parenthesis ()) of a cast".
It does not appear that CheckStyle is enforcing this requirement; therefore, there is no warning that all of the commas are missing spaces.
/var/tmp $ javac Test.java:/var/tmp $ cat Test.java:/var/tmp $ cat config.xml:(We're using Google Style at this commit: https://github.com/checkstyle/checkstyle/blob/60f41e3c16e6c94b0bf8c2e5e4b4accf4ad394ab/src/main/resources/google_checks.xml).
/var/tmp $ java -Duser.language=en -Duser.country=US -jar checkstyle-8.8-all.jar -c config.xml Test.java:According to section 4.6.2 of the official Google Style Guide, item 5 indicates that "a single ASCII space" should appear after commas, colons, semicolons, "or the closing parenthesis ()) of a cast".
It does not appear that CheckStyle is enforcing this requirement; therefore, there is no warning that all of the commas are missing spaces.