Skip to content

PrivateMethodCheck: force programmers to introduce new class instead #87

Description

@h1alexbel

I think we should make private methods illegal to use, long-story-short, here is main reasons "why":

  1. Private methods are not reusable between objects
  2. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions