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

import java.util.stream.Stream;

public class InputFinalLocalVariableLeavingSlistToken {

    private int assignedInInstanceInitAndCtor;
    private static int assignedInStaticInitAndFoo1;

    {
        assignedInInstanceInitAndCtor = 1;
    }

    static {
        assignedInStaticInitAndFoo1 = 1;
    }

    InputFinalLocalVariableLeavingSlistToken() {
        assignedInInstanceInitAndCtor = 2;
    }

    void foo1() {
        assignedInStaticInitAndFoo1 = 2;
    }

    void foo2() {
        int a;
        if (true) {
        }
        else {
            a = 1;

            try {
            } catch (Exception e) {
            } finally {
            }

            if (true) {
            }

            Stream.of(1).forEach(integer -> {});

            synchronized (InputFinalLocalVariableLeavingSlistToken.class) {
            }

            for (int i = 0; i < 0; ++i) {
            }
            while (Math.random() > 0) {
            }
            do {
            }
            while (Math.random() > 0);

            {}

            a = 2;
        }
    }
}