Steve Chambers Steve Chambers - 1 year ago 92
Java Question

Is there a Checkstyle/PMD rule "Non-abstract classes should not be named AbstractXXX"?

The Java project I'm working on uses a combination of code analysis tools: PMD, Checkstyle and FindBugs. These pick up on plenty of bugs, style issues etc. but one often slips through the net:

public class AbstractBadlyNamedClass { // Not abstract!
// ...

Note the other way round is checked, i.e.
public abstract BadlyNamedClass
gives PMD warning "Abstract classes should be named AbstractXXX".

Could anyone advise whether there is a way of checking for this, either with one of the mentioned tools (perhaps some kind of custom rule?) or another automated tool that would do the job?

Answer Source

I think the checkstyle AbstractClassName check is what you are looking for.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download