View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   // Created: 2001
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks;
6   
7   import java.io.*; 
8   import java.awt.Dimension;
9   import java.awt.Color;
10  
11  class Catch {
12      boolean flag;
13      void doSm() {}
14      void foo() {
15          try {
16             if (!flag) {
17                 doSm();
18             }
19          } catch (Exception e) { /* ignore */ } //ok
20          finally {/* ignore */} //ok
21      }
22  
23      void foo2() {
24          try {
25             if (!flag) {
26                 doSm();
27             }
28          } catch (Exception e) {} //warn
29          finally {}
30      }
31  
32      class Inner {
33          boolean flag;
34          void doSm() {}
35          void foo() {
36              try {
37                 if (!flag) {
38                     doSm();
39                 }
40              } catch (Exception e) { /* ignore */ } //ok
41              finally {/* ignore */} //ok
42          }
43  
44          void foo2() {
45              try {
46                 if (!flag) {
47                     doSm();
48                 }
49              } catch (Exception e) {} //warn
50              finally {}
51          }
52      }
53      
54      Inner anon = new Inner(){
55          boolean flag;
56          void doSm() {}
57          void foo() {
58              try {
59                 if (!flag) {
60                     doSm();
61                 }
62              } catch (Exception e) { /* ignore */ } //ok
63              finally {/* ignore */} //ok
64          }
65  
66          void foo2() {
67              try {
68                 if (!flag) {
69                     doSm();
70                 }
71              } catch (Exception e) {} //warn
72              finally {}
73          }
74      };
75  
76      void foo3() {
77          try {
78              foo();
79          } catch (Exception e) {} //warn
80  
81          try {
82              foo();
83          } catch (Exception e) /*warn*/ {
84  
85          }
86      }
87  }