View Javadoc
1   /*
2   com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck
3   id = ignore
4   format = (default)^[a-z][a-zA-Z0-9]*$
5   applyToPublic = (default)true
6   applyToProtected = (default)true
7   applyToPackage = (default)true
8   applyToPrivate = (default)true
9   
10  
11  com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck
12  id = (null)
13  format = (default)^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$
14  applyToPublic = (default)true
15  applyToProtected = (default)true
16  applyToPackage = (default)true
17  applyToPrivate = (default)true
18  
19  
20  com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck
21  illegalClassNames = (default)Error, Exception, RuntimeException, Throwable, java.lang.Error, \
22                      java.lang.Exception, java.lang.RuntimeException, java.lang.Throwable
23  
24  
25  */
26  
27  package com.puppycrawl.tools.checkstyle.filters.suppressioncommentfilter;
28  
29  /**
30   * Test input for using comments to suppress violations.
31   * @author Rick Giles
32   **/
33  class InputSuppressionCommentFilter
34  {
35      private int I; // violation
36  
37      /* CHECKSTYLE:OFF */
38      private int J; // violation
39      /* CHECKSTYLE:ON */
40  
41      private int K; // violation
42  
43      //CSOFF: MemberNameCheck|ConstantNameCheck
44      private int L; // violation
45      private static final int m = 0; // violation
46      /*
47       * CSON: MemberNameCheck|ConstantNameCheck
48       */
49      private int M2;//CSOFF: ConstantNameCheck // violation
50      private static final int n = 0; // violation
51      //CSON: ConstantNameCheck
52  
53      //CS_OFF
54      private int P; // violation
55      //CS_ON
56  
57      private int Q; // violation
58  
59      //CS_OFF: ConstantNameCheck
60      private int R; // violation
61      private static final int s = 0; // violation
62      //CS_ON
63  
64      //CHECKSTYLE:OFF
65      private int T; // violation
66      //CHECKSTYLE:ON
67  
68      //UNUSED OFF: aInt
69      public static void doit1(int aInt)
70      {
71      }
72      //UNUSED ON: aInt
73      public static void doit2(int aInt)
74      {
75      }
76  
77      public void doit3()
78      {
79          try {
80              // lots of code omitted
81              for(int i = 0; i < 10; i++) {
82                  // more code omitted
83                  while(true) {
84                      try {
85                          //CHECKSTYLE:OFF
86                      } catch(Exception e) { // violation
87                         //CHECKSTYLE:ON
88                      }
89                  }
90                  // code omitted
91              }
92              //CHECKSTYLE:OFF
93          } catch(Exception ex) { // violation
94              //CHECKSTYLE:ON
95          }
96  
97          try{
98              //IllegalCatchCheck OFF: Exception
99          } catch(RuntimeException ex){ // violation
100         } catch(Exception ex){ // violation
101             //IllegalCatchCheck ON: Exception
102         }
103     }
104 
105     public void doit4() {
106         try {
107 
108         /* CHECKSTYLE:OFF */} catch(Exception e) {/* CHECKSTYLE:ON */ // violation
109 
110         }
111     }
112 }