resources.report.rules.pmd.AvoidFieldNameMatchingMethodName.html Maven / Gradle / Ivy
AvoidFieldNameMatchingMethodName
AvoidFieldNameMatchingMethodName
It can be confusing to have a field name with the same name as a method. While this is permitted, having information (field) and actions (method) is not clear naming. Developers versed in Smalltalk often prefer this approach as the methods denote accessor methods.
This rule is defined by the following Java class: net.sourceforge.pmd.lang.java.rule.naming.AvoidFieldNameMatchingMethodNameRule
Example(s):
public class Foo {
Object bar;
// bar is data or an action or both?
void bar() {
}
}