forked from checkstyle/checkstyle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputArrayTrailingComma.java
84 lines (69 loc) · 1.46 KB
/
InputArrayTrailingComma.java
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
/*
ArrayTrailingComma
alwaysDemandTrailingComma = (default)false
*/
package com.puppycrawl.tools.checkstyle.checks.coding.arraytrailingcomma;
public class InputArrayTrailingComma
{
int[] a1 = new int[]
{
1,
2,
3,
};
int[] a2 = new int[]
{
1,
2,
3 // violation 'Array should contain trailing comma.'
};
int[] b1 = new int[] {1, 2, 3,};
int[] b2 = new int[] {1, 2, 3};
int[][] c1 = new int[][] {{1, 2,}, {3, 3,}, {5, 6,},};
int[][] c2 = new int[][] {{1, 2}, {3, 3,}, {5, 6,}};
int[][] d1 = new int[][]
{
{1, 2,},
{3, 3,},
{5, 6,},
};
int[][] d2 = new int[][]
{
{1,
2},
{3, 3,},
{5, 6,} // violation 'Array should contain trailing comma.'
};
int[] e1 = new int[] {
};
int[] f1 = new int[] {0, 1
};
int[][] f2 = new int[][]
{
{1,
2,},
};
int[] f3 = new int[]{
1,
2
,
};
int[] f4 = new int[]{
1,
2
,};
Object[][] g1 = new Object[][]
{
{ 1, 1 },
{
null,
new int[] { 2,
3 }, }, };
Object[][] g2 = new Object[][]
{
{ 1, 1 },
{ // violation 'Array should contain trailing comma.'
null,
new int[] { 2, // violation 'Array should contain trailing comma.'
3 } } };
}