aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/com/puppycrawl/tools/checkstyle/filters/suppresswithnearbycommentfilter/InputSuppressWithNearbyCommentFilter.java
blob: b7e086359794a8ad5f80b9be711cadf0fec58fd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
////////////////////////////////////////////////////////////////////////////////
// Test case file for checkstyle.
////////////////////////////////////////////////////////////////////////////////

package com.puppycrawl.tools.checkstyle.filters.suppresswithnearbycommentfilter;

/**
 * Test input for using comments to suppress errors.
 * 
 * @author Mick Killianey
 */
class InputSuppressWithNearbyCommentFilter
{
    private int A1;  // SUPPRESS CHECKSTYLE MemberNameCheck
    private int A2;  /* SUPPRESS CHECKSTYLE MemberNameCheck */
    /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int A3;  
    
    private int B1;  // SUPPRESS CHECKSTYLE MemberNameCheck
    private int B2;  /* SUPPRESS CHECKSTYLE MemberNameCheck */
    /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int B3;  
    
    private int C1;
    // ALLOW MemberName ON NEXT LINE
    private int C2;
    private int C3;  
    
    private int D1;
    private int D2;
    // ALLOW MemberName ON PREVIOUS LINE
    private int D3;  
    
    private static final int e1 = 0;
    private int E2;
    private int E3;    // ALLOW ConstantName UNTIL THIS LINE+2
    private static final int e4 = 0;
    private int E5;
    private static final int e6 = 0;
    private int E7;
    private int E8;    /* ALLOW MemberName UNTIL THIS LINE-3 */
    private static final int e9 = 0;
    
    // ALLOW Unused UNTIL THIS LINE+5
    public static void doit1(int aInt) // this is +1
    {
    }

    public static void doit2(int aInt) // this is +5
    {
    }

    public static void doit3(int aInt) // this is +9
    {
    }

    public void doit4()
    {
        try {
            // blah blah blah
            for(int i = 0; i < 10; i++) {
                // blah blah blah
                while(true) {
                    try {
                        // blah blah blah
                    } catch(Exception e) {
                        // bad bad bad
                    } catch (Throwable t) {
                    	// ALLOW CATCH Throwable BECAUSE I threw this together.
                    }
                }
                // blah blah blah
            }
            // blah blah blah
        } catch(Exception ex) {
            // ALLOW CATCH Exception BECAUSE I am an exceptional person.
        }
    }
}

class Magic {
    /* SUPPRESS CHECKSTYLE MemberNameCheck */ private int A2; /* SUPPRESS CHECKSTYLE MemberNameCheck ololo */
    private int A1;
}