Class NonStaticMethodCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public final class NonStaticMethodCheck
    extends AbstractCheck
    Checks that non static method must contain at least one reference to this.

    If your method doesn't need this than why it is not static? The exception here is when method has @Override annotation. There's no concept of inheritance and polymorphism for static methods even if they don't need this to perform the actual work. Another exception is when method is abstract or native. Such methods don't have body so detection based on this doesn't make sense for them.

    • Constructor Detail

      • NonStaticMethodCheck

        public NonStaticMethodCheck()