View Javadoc
1   /*
2   RightCurly
3   option = ALONE
4   tokens = LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
10  
11  class InputRightCurlyTestForceLineBreakBefore
12  {
13      /** @see test method **/
14      int foo() throws InterruptedException
15      {
16          int x = 1;
17          int a = 2;
18          while (true)
19          {
20              try
21              {
22                  if (x > 0)
23                  {
24                      break;
25                  } else if (x < 0) {
26                      ;
27                  } else { break; }
28                  switch (a)
29                  {
30                  case 0:
31                      break;
32                  default:
33                      break;
34                  }
35              } catch (Exception e) { break; } finally { break; }
36          }
37          // violation below ''}' at column 43 should be alone on a line'
38          synchronized (this) { do { x = 2; } while (x == 2); }
39  
40          synchronized (this) {
41              do {} while (x == 2); // violation ''}' at column 17 should be alone on a line'
42          }
43          // violation below ''}' at column 71 should be alone on a line'
44          for (int k = 0; k < 1; k++) { String innerBlockVariable = ""; }
45  
46          for (int k = 0; k < 1; k++) {} // violation ''}' at column 38 should be alone on a line'
47                  return a;
48      }
49  
50      static { int x = 1; } // violation ''}' at column 25 should be alone on a line'
51  
52      void method2()
53      {
54          boolean flag = false;
55          if (flag) { String.valueOf("foo"); }
56      }
57  }
58  
59  class Absent_CustomFieldSerializer {
60  
61      public static void serialize() {}
62  }
63  
64  class Absent_CustomFieldSerializer10
65  {
66      public Absent_CustomFieldSerializer10() {}
67  }
68  
69  class EmptyClass {}
70  
71  interface EmptyInterface {}