Since 0.7
Bad code: |
Good code: |
|
public static final int[] maxDimensions = {10, 10, 10};
|
public static final List<Integer> maxDimensions;
static {
Integer[] dimensions = {10, 10, 10};
maxDimensions = Collections.unmodifiableList(
Arrays.asList(dimensions));
}
|
|
private static final int[] sizes = {10, 10, 10};
public static int[] getSizes() {
return sizes;
}
|
private static final int[] sizes = {10, 10, 10};
public static int[] getSizes() {
int[] result = new int[sizes.length];
System.arraycopy(sizes, 0, result, 0, sizes.length);
return result;
}
|
|
This code check requires Eclipse to resolve bindings. Enabling this code check increases build time.
Warnings generated by this codecheck can be suppressed by adding the @SuppressWarnings("visible-array") annotation.