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.suppresswithnearbycommentfilter;
28  
29  /**
30   * Test input for using comments to suppress violations.
31   *
32   * @author Mick Killianey
33   */
34  public class InputSuppressWithNearbyCommentFilterWithoutFilter {
35      // violation below
36      private int A1;  // SUPPRESS CHECKSTYLE MemberNameCheck
37  
38      // violation below
39      private int A2;  /* SUPPRESS CHECKSTYLE MemberNameCheck */
40      /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int A3; // violation
41  
42      // violation below
43      private int B1;  // SUPPRESS CHECKSTYLE MemberNameCheck
44  
45      // violation below
46      private int B2;  /* SUPPRESS CHECKSTYLE MemberNameCheck */
47      /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int B3; // violation
48  
49      private int C1; // violation
50      // ALLOW MemberName ON NEXT LINE
51      private int C2; // violation
52      private int C3; // violation
53  
54      private int D1; // violation
55      private int D2; // violation
56      // ALLOW MemberName ON PREVIOUS LINE
57      private int D3; // violation
58  
59      private static final int e1 = 0; // violation
60      private int E2; // violation
61  
62      // violation below
63      private int E3;    // ALLOW ConstantName UNTIL THIS LINE+2
64      private static final int e4 = 0; // violation
65      private int E5; // violation
66      private static final int e6 = 0; // violation
67      private int E7; // violation
68      private int E8;    /* ALLOW MemberName UNTIL THIS LINE-3 */
69      // violation above
70      private static final int e9 = 0; // violation
71  
72      // ALLOW Unused UNTIL THIS LINE+5
73      public static void doit1(int aInt) { // this is +1
74      }
75  
76      public static void doit2(int aInt) { // this is +5
77      }
78  
79      public static void doit3(int aInt) { // this is +9
80      }
81  
82      public void doit4() {
83          try {
84              // blah blah blah
85              for(int i = 0; i < 10; i++) {
86                  // blah blah blah
87                  while(true) {
88                      try {
89                          // blah blah blah
90                      } catch(Exception e) { // violation
91                          // bad bad bad
92                      } catch (Throwable t) { // violation
93                          // ALLOW CATCH Throwable BECAUSE I threw this together.
94                      }
95                  }
96                  // blah blah blah
97              }
98              // blah blah blah
99          } catch(Exception ex) { // violation
100             // ALLOW CATCH Exception BECAUSE I am an exceptional person.
101         }
102     }
103 }
104 
105 class Magic10 {
106     // violation below
107     /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int A2;/* SUPPRESS CHECKSTYLE MemberName ol */
108     private int A1; // violation
109 }