The BeanMembersShouldSerialize rule from the JavaBeans rule set is generating false positives when using an Inversion of Control framework.
For example:
public class Foo {
@In
SessionContext sessionContext;
...
}
The sessionContext field will be injected from the IoC container, so I don't need to add an accessor or mutator. Adding transient would be misleading because the class is not serializable.
http://pmd.sourceforge.net/rules/javabeans.html#BeanMembersShouldSerialize
I guess the logical solution would be to be able to customize the rule to skip if certain annotations are present, such as @In (Seam, Guice), @Resource (Spring), @EJB (EJB 3), etc.
See Bug 881 too: https://sourceforge.net/p/pmd/bugs/881/