Understanding the NoWhitespaceBefore Check
I may be misunderstanding the NoWhitespaceBefore check, but my current understanding is that it should detect and flag any unwanted whitespace that appears before specific tokens, including:
- Dots (
.)
- Semicolons (
;)
- String literals (
"")
- Method call parentheses (
())
- Other similar syntax elements
The check's purpose is to identify and report any unnecessary whitespace preceding these tokens.
Testing Observations:
When testing with 10 straightforward examples, only 1 violation was detected. This low detection rate raises concerns about either:
- The check's current implementation
- My interpretation of its intended behavior
Test Case Demonstration
public void testSpaceViolation2() {
"".equals(""); // Expected violation
"" .equals(""); // Expected violation - found by current impl. of NoWhitespaceBeforeCheck
"". equals(""); // Expected violation
"".equals (""); // Expected violation
"".equals( ""); // Expected violation
"".equals("" ); // Expected violation
"".equals("") ; // Expected violation
" ".equals("");
"".equals(" ");
}

Understanding the
NoWhitespaceBeforeCheckI may be misunderstanding the
NoWhitespaceBeforecheck, but my current understanding is that it should detect and flag any unwanted whitespace that appears before specific tokens, including:.);)"")())The check's purpose is to identify and report any unnecessary whitespace preceding these tokens.
Testing Observations:
When testing with 10 straightforward examples, only 1 violation was detected. This low detection rate raises concerns about either:
Test Case Demonstration