View Javadoc
1   /*
2   WhitespaceAround
3   allowEmptyConstructors = (default)false
4   allowEmptyMethods = (default)false
5   allowEmptyTypes = (default)false
6   allowEmptyLoops = (default)false
7   allowEmptyLambdas = (default)false
8   allowEmptyCatches = (default)false
9   ignoreEnhancedForColon = (default)true
10  tokens = ARRAY_INIT
11  
12  
13  */
14  
15  package com.puppycrawl.tools.checkstyle.checks.whitespace.whitespacearound;
16  
17  public class InputWhitespaceAroundArrayInitialization {
18  
19      public void arrayInitTest() {
20  
21          final int[] COLORS = new int[]{5 }; // violation ''{' is not preceded with whitespace'
22  
23          final int[] COLORS1 = new int[] {5 }; // valid
24  
25          final String[][] COLORS2 = {{""}, {""}}; // violation ''{' is not preceded with whitespace'
26  
27          final String[][] COLORS21
28                  = { {"", ""},{""} }; // violation ''{' is not preceded with whitespace'
29  
30          final String[][] COLORS22 = { {"White", "Yellow"}, {"Pink"} }; //valid
31  
32          final String[][][] COLORS31 = { { {"Black", "Blue"}, {"Gray", "White"}},
33                                         { {"Green", "Brown", "Magneta"}},
34                                         { {"Red", "Purple", "Violet"}} }; //valid
35  
36          final String[][][] COLORS32 = { {{"Red", "Green"},{"Pink"}} }; // 2 violations
37  
38          final String[][][] COLORS33 = {{{"White"}}}; // 2 violations
39  
40          final String[][][][] COLORS41 = { { { {"Green"}}, { {"Purple"}}}, { { {"Yellow"}}} };//valid
41  
42          final String[][][][] COLORS42 = {
43                  { {{"", ""}, // violation ''{' is not preceded with whitespace'
44                     {"Gray", "Black"},},},
45                     { { {"Red"}}}};
46  
47      }
48  
49  }