1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="RightCurly"> 5 <property name="option" value="alone"/> 6 <property name="tokens" value="LITERAL_SWITCH, LITERAL_CASE"/> 7 </module> 8 </module> 9 </module> 10 */ 11 12 package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly; 13 14 // xdoc section -- start 15 class Example3 { 16 17 public void method0() { 18 int mode = 0; 19 int x; 20 switch (mode) { 21 case 1: 22 int y = 1; 23 break; 24 case 2: {x = 1;} // violation '}' at column 22 should be alone on a line' 25 case 3: int z = 0; {break;} // ok, the braces is not a first child of case 26 default: 27 x = 0; 28 } // ok, RightCurly is alone 29 } 30 31 public void method01() { 32 int mode = 0; 33 switch (mode) { 34 case 1: 35 int x = 1; 36 break; 37 default: 38 x = 0; } 39 // violation above, 'should be alone on a line.' 40 } 41 } 42 // xdoc section -- end