View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   ////////////////////////////////////////////////////////////////////////////////
4   
5   package com.puppycrawl.tools.checkstyle.filters.suppresswithnearbycommentfilter;
6   
7   /**
8    * Test input for using comments to suppress errors.
9    * 
10   * @author Mick Killianey
11   */
12  class InputSuppressWithNearbyCommentFilter
13  {
14      private int A1;  // SUPPRESS CHECKSTYLE MemberNameCheck
15      private int A2;  /* SUPPRESS CHECKSTYLE MemberNameCheck */
16      /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int A3;  
17      
18      private int B1;  // SUPPRESS CHECKSTYLE MemberNameCheck
19      private int B2;  /* SUPPRESS CHECKSTYLE MemberNameCheck */
20      /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int B3;  
21      
22      private int C1;
23      // ALLOW MemberName ON NEXT LINE
24      private int C2;
25      private int C3;  
26      
27      private int D1;
28      private int D2;
29      // ALLOW MemberName ON PREVIOUS LINE
30      private int D3;  
31      
32      private static final int e1 = 0;
33      private int E2;
34      private int E3;    // ALLOW ConstantName UNTIL THIS LINE+2
35      private static final int e4 = 0;
36      private int E5;
37      private static final int e6 = 0;
38      private int E7;
39      private int E8;    /* ALLOW MemberName UNTIL THIS LINE-3 */
40      private static final int e9 = 0;
41      
42      // ALLOW Unused UNTIL THIS LINE+5
43      public static void doit1(int aInt) // this is +1
44      {
45      }
46  
47      public static void doit2(int aInt) // this is +5
48      {
49      }
50  
51      public static void doit3(int aInt) // this is +9
52      {
53      }
54  
55      public void doit4()
56      {
57          try {
58              // blah blah blah
59              for(int i = 0; i < 10; i++) {
60                  // blah blah blah
61                  while(true) {
62                      try {
63                          // blah blah blah
64                      } catch(Exception e) {
65                          // bad bad bad
66                      } catch (Throwable t) {
67                      	// ALLOW CATCH Throwable BECAUSE I threw this together.
68                      }
69                  }
70                  // blah blah blah
71              }
72              // blah blah blah
73          } catch(Exception ex) {
74              // ALLOW CATCH Exception BECAUSE I am an exceptional person.
75          }
76      }
77  }
78  
79  class Magic {
80      /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int A2; /* SUPPRESS CHECKSTYLE MemberNameCheck ololo */
81      private int A1;
82  }