aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/com/puppycrawl/tools/checkstyle/filters/suppressioncommentfilter/InputSuppressionCommentFilter.java
blob: a87a63114ea01192b0ed789014d3014b7bbe6ca0 (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
83
84
85
86
87
88
89
90
////////////////////////////////////////////////////////////////////////////////
// Test case file for checkstyle.
////////////////////////////////////////////////////////////////////////////////

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

/**
 * Test input for using comments to suppress errors.
 * @author Rick Giles
 **/
class InputSuppressionCommentFilter
{
    private int I;
    
    /* CHECKSTYLE:OFF */
    private int J;
    /* CHECKSTYLE:ON */
    
    private int K;

    //CSOFF: MemberNameCheck|ConstantNameCheck
    private int L;
    private static final int m = 0;
    /*
     * CSON: MemberNameCheck|ConstantNameCheck
     */
    private int M2;//CSOFF: ConstantNameCheck
    private static final int n = 0;
    //CSON: ConstantNameCheck
    
    //CS_OFF
    private int P;
    //CS_ON
    
    private int Q;
    
    //CS_OFF: ConstantNameCheck
    private int R;
    private static final int s = 0;
    //CS_ON
    
    //CHECKSTYLE:OFF
    private int T;
    //CHECKSTYLE:ON

    //UNUSED OFF: aInt
    public static void doit1(int aInt)
    {
    }
    //UNUSED ON: aInt
    public static void doit2(int aInt)
    {
    }

    public void doit3()
    {
        try {
            // lots of code omitted
            for(int i = 0; i < 10; i++) {
                // more code omitted
                while(true) {
                    try {
                        //CHECKSTYLE:OFF
                    } catch(Exception e) {
                       //CHECKSTYLE:ON
                    }
                }
                // code omitted
            }
            //CHECKSTYLE:OFF
        } catch(Exception ex) {
            //CHECKSTYLE:ON
        }

        try{
            //IllegalCatchCheck OFF: Exception
        } catch(RuntimeException ex){
        } catch(Exception ex){
            //IllegalCatchCheck ON: Exception
        }
    }

    public void doit4() {
        try {

        /* CHECKSTYLE:OFF */} catch(Exception e) {/* CHECKSTYLE:ON */

        }
    }
}