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

public class InputExplicitInitialization {
    private int x = 0;
    private Object bar = /* comment test */null;
    private int y = 1;
    private long y1 = 1 - 1;
    private long y3;
    private long y4 = 0L;
    private boolean b1 = false;
    private boolean b2 = true;
    private boolean b3;
    private String str = "";
    java.lang.String str1 = null, str3 = null;
    int ar1[] = null;
    int ar2[] = new int[1];
    int ar3[];
    float f1 = 0f;
    double d1 = 0.0;

    static char ch;
    static char ch1 = 0;
    static char ch2 = '\0';
    static char ch3 = '\1';

    void method() {
        int xx = 0;
        String s = null;
    }
}

interface interface1{
    int TOKEN_first = 0x00;
    int TOKEN_second = 0x01;
    int TOKEN_third = 0x02;
}

class InputExplicitInit2 {
    private Bar<String> bar = null;
    private Bar<String>[] barArray = null;
}

enum InputExplicitInit3 {
    A,
    B
    {
        private int x = 0;
        private Bar<String> bar = null;
        private Bar<String>[] barArray = null;
        private int y = 1;
    };
    private int x = 0;
    private Bar<String> bar = null;
    private Bar<String>[] barArray = null;
    private int y = 1;
}

@interface annotation1{
    int TOKEN_first = 0x00;
    int TOKEN_second = 0x01;
    int TOKEN_third = 0x02;
}

class ForEach {
    public ForEach(java.util.Collection<String> strings)
    {
        for(String s : strings) //this should not even be checked
        {

        }
    }
}

class Bar<T> {
}

class Chars {
    char a;
    char b = a;
    byte c = 1;
    short d = 1;
}