View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   ////////////////////////////////////////////////////////////////////////////////
4   
5   package com.puppycrawl.tools.checkstyle.filters.suppressioncommentfilter;
6   
7   /**
8    * Test input for using comments to suppress errors.
9    * @author Rick Giles
10   **/
11  class InputSuppressionCommentFilter
12  {
13      private int I;
14      
15      /* CHECKSTYLE:OFF */
16      private int J;
17      /* CHECKSTYLE:ON */
18      
19      private int K;
20  
21      //CSOFF: MemberNameCheck|ConstantNameCheck
22      private int L;
23      private static final int m = 0;
24      /*
25       * CSON: MemberNameCheck|ConstantNameCheck
26       */
27      private int M2;//CSOFF: ConstantNameCheck
28      private static final int n = 0;
29      //CSON: ConstantNameCheck
30      
31      //CS_OFF
32      private int P;
33      //CS_ON
34      
35      private int Q;
36      
37      //CS_OFF: ConstantNameCheck
38      private int R;
39      private static final int s = 0;
40      //CS_ON
41      
42      //CHECKSTYLE:OFF
43      private int T;
44      //CHECKSTYLE:ON
45  
46      //UNUSED OFF: aInt
47      public static void doit1(int aInt)
48      {
49      }
50      //UNUSED ON: aInt
51      public static void doit2(int aInt)
52      {
53      }
54  
55      public void doit3()
56      {
57          try {
58              // lots of code omitted
59              for(int i = 0; i < 10; i++) {
60                  // more code omitted
61                  while(true) {
62                      try {
63                          //CHECKSTYLE:OFF
64                      } catch(Exception e) {
65                         //CHECKSTYLE:ON
66                      }
67                  }
68                  // code omitted
69              }
70              //CHECKSTYLE:OFF
71          } catch(Exception ex) {
72              //CHECKSTYLE:ON
73          }
74  
75          try{
76              //IllegalCatchCheck OFF: Exception
77          } catch(RuntimeException ex){
78          } catch(Exception ex){
79              //IllegalCatchCheck ON: Exception
80          }
81      }
82  
83      public void doit4() {
84          try {
85  
86          /* CHECKSTYLE:OFF */} catch(Exception e) {/* CHECKSTYLE:ON */
87  
88          }
89      }
90  }