CODSTA.DCI
Define constants in an "interface"
Description
This rule flags any non-private named constant that is not defined in an "interface".
Example
package CODSTA;
class DCI{
private int[] getArray () {
return new int [ARRAY_SIZE];
}
static final int ARRAY_SIZE = 1000;
}
Repair
class USN_fixed {
private int[] getArray () {
return new int [Constants.ARRAY_SIZE];
}
}
interface Constants {
int ARRAY_SIZE = 1000;
}
|