Class AbstractMethodCallCheck

    • Constructor Detail

      • AbstractMethodCallCheck

        public AbstractMethodCallCheck()
    • Method Detail

      • isCheckActive

        protected abstract boolean isCheckActive()
        Determines if the check is configured to do anything at all.
        Returns:
        true if processing should be performed
      • isRelevantCall

        protected abstract boolean isRelevantCall​(@Nullable
                                                  String pQualifier,
                                                  @Nonnull
                                                  String pMethodName)
        Filter method which determines if the given method call is considered relevant.
        Parameters:
        pQualifier - the qualifier of the method call (for a call like Foo.Bar.call(), the qualifier is Foo.Bar)
        pMethodName - the simple name of the called method
        Returns:
        indication of whether the call is relevant (true) or not (false)
      • visitMethodCall

        protected abstract void visitMethodCall​(@Nonnull
                                                String pMethodName,
                                                @Nonnull
                                                DetailAST pMethodCallAst)
        Visitor method called when a relevant method call is encountered. This method is called in addition to the other visitor methods.
        Parameters:
        pMethodName - the simple name of the called method
        pMethodCallAst - AST of the call, useful for logging issues ( this is a METHOD_DEF, CTOR_CALL, or a SUPER_CTOR_CALL token)
      • getCurrentMethodName

        @CheckForNull
        public String getCurrentMethodName()
        The current method name. "<init>" is used for constructors and instance initializers, and "<clinit>" is used for static initializers.
        Returns:
        the method name, or null if we are not inside a method, constructor, or initializer