forked from checkstyle/checkstyle
/
InputArrayTypeStyle.java
64 lines (54 loc) · 1.42 KB
/
InputArrayTypeStyle.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
package com.google.checkstyle.test.chapter4formatting.rule4832nocstylearray;
/**
* Test case for ArrayTypeStyle (Java vs C)
**/
public class InputArrayTypeStyle
{
private int[] javaStyle = new int[0];
private int cStyle[] = new int[0]; //warn
public static void mainJava(String[] aJavaStyle) //ok
{
}
public static void mainC(String aCStyle[]) //warn
{
final int[] blah = new int[0]; //ok
final boolean isOK1 = aCStyle instanceof String[]; //ok
final boolean isOK2 = aCStyle instanceof java.lang.String[]; //ok
final boolean isOK3 = blah instanceof int[]; //ok
int[] array[] = new int [2][2]; //warn
int array2[][][] = new int[3][3][3]; //warn
}
public class Test
{
public Test[]
variable; //ok
public Test[]
getTests()
{
return null;
}
public Test[] getNewTest() //ok
{
return null;
}
public Test getOldTest()[] //warn
{
return null;
}
public Test getOldTests()[][] //warn
{
return null;
}
public Test[]
getMoreTests()[] //warn
{
return null;
}
public Test[][] getTests2() //ok
{
return null;
}
}
int[] array[] = new int [2][2]; //warn
int array2[][][] = new int[3][3][3]; //warn
}