1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="WhitespaceAround"/> 5 </module> 6 </module> 7 8 9 */ 10 11 package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound; 12 13 // xdoc section -- start 14 class Example1 { 15 public Example1(){} // 3 violations 16 // no space after ')' and '{', no space before '}' 17 public static void main(String[] args) { 18 if (true) { } 19 else{ // 2 violations 20 // no space after 'else', no space before '}' 21 } 22 23 for (int i = 1; i > 1; i++) {} // 2 violations 24 // no space after '{', no space before '}' 25 26 Runnable noop = () ->{}; // 4 violations 27 // no space after '->' and '{', no space before '{' and '}' 28 try { } 29 catch (Exception e){} // 3 violations 30 // no space after ')' and '{', no space before '}' 31 char[] vowels = {'a', 'e', 'i', 'o', 'u'}; 32 for (char item: vowels) { // OK, ignoreEnhancedForColon is true by default 33 34 } 35 } 36 } 37 // xdoc section -- end