View Javadoc
1   /*
2   ArrayTrailingComma
3   alwaysDemandTrailingComma = (default)false
4   
5   
6   */
7   
8   package com.puppycrawl.tools.checkstyle.checks.coding.arraytrailingcomma;
9   
10  public class InputArrayTrailingComma
11  {
12      int[] a1 = new int[]
13      {
14          1,
15          2,
16          3,
17      };
18  
19      int[] a2 = new int[]
20      {
21          1,
22          2,
23          3 // violation 'Array should contain trailing comma.'
24      };
25  
26      int[] b1 = new int[] {1, 2, 3,};
27      int[] b2 = new int[] {1, 2, 3};
28  
29      int[][] c1 = new int[][] {{1, 2,}, {3, 3,}, {5, 6,},};
30      int[][] c2 = new int[][] {{1, 2}, {3, 3,}, {5, 6,}};
31  
32      int[][] d1 = new int[][]
33      {
34          {1, 2,},
35          {3, 3,},
36          {5, 6,},
37      };
38      int[][] d2 = new int[][]
39      {
40          {1,
41           2},
42          {3, 3,},
43          {5, 6,} // violation 'Array should contain trailing comma.'
44      };
45  
46      int[] e1 = new int[] {
47      };
48  
49      int[] f1 = new int[] {0, 1
50      };
51  
52      int[][] f2 = new int[][]
53      {
54          {1,
55           2,},
56      };
57  
58      int[] f3 = new int[]{
59              1,
60              2
61              ,
62      };
63  
64      int[] f4 = new int[]{
65              1,
66              2
67              ,};
68  
69      Object[][] g1 = new Object[][]
70      {
71          { 1, 1 },
72          {
73             null,
74             new int[] { 2,
75                     3 }, }, };
76  
77      Object[][] g2 = new Object[][]
78      {
79          { 1, 1 },
80          { // violation 'Array should contain trailing comma.'
81             null,
82             new int[] { 2, // violation 'Array should contain trailing comma.'
83                     3 } } };
84  }