I think we should make private methods illegal to use, long-story-short, here is main reasons "why":
- Private methods are not reusable between objects
- Private methods are not testable
consider this example:
final class Cat {
public void meow() {
this.print();
}
private void print() {
}
}
OOPCOP should fail this class with a message like this:
Private method detected in Cat.java[6]. Consider creating new class instead. It's both: reusable and testable, see: $blog link (PrivateMethodCheck)
also, it should be suppressible:
@SuppressWarnings("OCOP.PrivateMethodCheck")
@l3r8yJ what do you think?
I think we should make private methods illegal to use, long-story-short, here is main reasons "why":
consider this example:
OOPCOP should fail this class with a message like this:
also, it should be suppressible:
@l3r8yJ what do you think?