array-type-style
What it does
Section titled “What it does”Reports a variable or parameter that puts the array brackets after the name (int a[]).
Why it matters
Section titled “Why it matters”In Java the brackets are part of the type, and int[] a says it at the start. The C form is allowed for compatibility and makes the type hard to read, and int[] a, b[] declares two different types in one line.
To fix, write the brackets after the type: int[] a.
Example
Section titled “Example”class A { int a[], b; int[] c;
void f(String s[], String[] t, int... u) { int d[] = new int[1]; }}Configuration
Section titled “Configuration”java: lint: rules: array-type-style: warn # off (default), warn, errorEnabled by the presets: java/google.
Suppress one line with sudsy-disable-next-line array-type-style in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| checkstyle | ArrayTypeStyle |
full |