View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule4832nocstylearray;
2   
3   /**
4    * Test case for ArrayTypeStyle (Java vs C)
5    **/
6   public class InputArrayTypeStyle
7   {
8       private int[] javaStyle = new int[0];
9       private int cStyle[] = new int[0]; //warn
10  
11      public static void mainJava(String[] aJavaStyle) //ok
12      {
13      }
14  
15      public static void mainC(String aCStyle[]) //warn
16      {
17          final int[] blah = new int[0]; //ok
18          final boolean isOK1 = aCStyle instanceof String[]; //ok
19          final boolean isOK2 = aCStyle instanceof java.lang.String[]; //ok
20          final boolean isOK3 = blah instanceof int[]; //ok
21          int[] array[] = new int [2][2]; //warn 
22          int array2[][][] = new int[3][3][3]; //warn
23      }
24  
25      public class Test
26      {
27          public Test[]
28              variable; //ok
29  
30          public Test[]
31              getTests()
32          { // we shouldn't check methods because there is no alternatives.
33              return null;
34          }
35  
36          public Test[] getNewTest() //ok
37          {
38              return null;
39          }
40      }
41      int[] array[] = new int [2][2]; //warn
42      int array2[][][] = new int[3][3][3]; //warn
43  }