currently the VariableNamingConventions rule requires that all static final variables must be named in upper case (e.g. MY_CONSTANT). However, according to the most code conventions (Java, Eclipse) only constants shall be named in upper case. We sometimes declare variables final although they are no constants. For example:
private static final Logger logger;
private static final HashMap<String,String> textCache = new HashMap<String,String>();
I would assume that a real constant is a final variable where the instance is immutable. Thus, I would only issue this warning, if the type of the variable is a primitive type or a wrapper for a primitive type (which is immutable).
What do you think about this potential rule change? If there is a consensus about the rule definition, i am willing to supply a patch.
Log in to post a comment.