aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/requirethis/InputRequireThisCaseGroup.java
blob: b32b99c58e33480d8f805fe9aebed20d77995a2e (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
package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;

public class InputRequireThisCaseGroup {
    private String aVariable;

    public String method1(int val) {
        switch (val) {
            case 0:
                String aVariable = "";
                
                if (this.aVariable != null) {
                    aVariable = this.aVariable;
                }
                
                return aVariable;
            default:
                return null;
        }
    }

    public String method2(int val) {
        switch (val) {
            case 0:
                String aVariable = "";
                
                if (this.aVariable != null) {
                    aVariable = this.aVariable;
                }
                
                return aVariable;
        }
        return null;
    }

    public String method3(int val) {
        switch (val) {
            case 0:
                String other = "";
                
                if (aVariable != null) {
                    other = aVariable;
                }
                
                return other;
        }
        return null;
    }
}