aboutsummaryrefslogtreecommitdiff
path: root/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/InputFallThrough2.java
blob: 33c380347af247376bfcf349614a414db255a23f (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
91
92
93
94
95
package com.puppycrawl.tools.checkstyle.checks.coding;

public class InputFallThrough2 {
    enum Test {
        A, B, C
    }

    public static void test() {
        Test test = Test.A;
        int variable = 0;

        switch (test) {
            case A:
                break;
            case B:
                if (variable == 1) {
                    // some work
                    break;
                }
            case C:
                break;
        }

        int var2 = 1;
        switch (variable) {
            case 0:
            case 1:
            case 2:
                System.identityHashCode(var2);
                break;
            case 3:
                if (true) {
                    return;
                }
            case 4:
                if (var2 == 2) {
                    break;
                }
            case 5:
                if (var2 == 1) {

                }
                else if (true) {
                    return;
                }
            case 6:
                if (var2 > 1) {
                    break;
                }
                else {
                    break;
                }
            case 7:
                if (var2 ==1) {
                    break;
                }
                else if (true) {
                    return;
                }
            case 8:
                if(var2 == 5) {
                    System.identityHashCode("0xB16B00B5");
                }
                else {
                    break;
                }
            case 9:
                if(var2 == 5) {
                    System.identityHashCode("0xCAFED00D");
                }
                else {
                    String.CASE_INSENSITIVE_ORDER.equals("0x4B1D");
                }
                break;
            case 10:
                int var3 = 0xDEADBEEF;
                switch (var3) {
                    case 0xCAFEBABE:
                        String.CASE_INSENSITIVE_ORDER.equals("0x1CEB00DA");
                    default:
                        String.CASE_INSENSITIVE_ORDER.equals("");
                }
                if(true) {
                    break;
                }
            case 11:
                if(false) {break;}
            case 12:
                if(true);
                break;
            default:
                break;
        }
    }
}