Class AbstractAddonsCheck

    • Constructor Detail

      • AbstractAddonsCheck

        protected AbstractAddonsCheck()
      • AbstractAddonsCheck

        protected AbstractAddonsCheck​(@Nullable
                                      String pMockfile)
    • Method Detail

      • getRelevantTokens

        public abstract Set<Integer> getRelevantTokens()
        The tokens which this check is interested in. Will be added to the tokens of the base class.
        Returns:
        the relevant tokens
      • finishTree

        protected void finishTree​(@Nonnull
                                  BinaryName pOuterClassName,
                                  @Nonnull
                                  DetailAST pRootAst)
        Called after a tree is fully processed. Ideal place to report on information collected whilst processing a tree.
        Parameters:
        pOuterClassName - the fully qualified class name of the outer class
        pRootAst - the root of the tree
      • visitToken

        protected void visitToken​(@Nullable
                                  BinaryName pBinaryClassName,
                                  @Nonnull
                                  DetailAST pAst)
        Called to process a token.
        Parameters:
        pBinaryClassName - the currently active binary class name
        pAst - the token to process
      • leaveToken

        protected void leaveToken​(@Nullable
                                  BinaryName pBinaryClassName,
                                  @Nonnull
                                  DetailAST pAst)
        Called after all the child nodes have been processed.
        Parameters:
        pBinaryClassName - the currently active binary class name
        pAst - the token being completed
      • visitKnownType

        protected void visitKnownType​(@Nonnull
                                      BinaryName pBinaryClassName,
                                      @Nonnull
                                      DetailAST pAst)
        Called after visiting a CLASS_DEF, INTERFACE_DEF, ANNOTATION_DEF, or ENUM_DEF token and successfully determining the type's binary class name. This is useful in a Java source file with nested inner classes. If the implementing check registers for any of the above tokens, the regular call to visitToken(BinaryName, DetailAST) will be performed in addition to (after) this one.
        Parameters:
        pBinaryClassName - the binary class name of the visited type
        pAst - the token to process
      • leaveKnownType

        protected void leaveKnownType​(@Nonnull
                                      BinaryName pBinaryClassName,
                                      @Nonnull
                                      DetailAST pAst)
        Called after leaving a CLASS_DEF, INTERFACE_DEF, ANNOTATION_DEF, or ENUM_DEF token and the type's binary class name is known. This is useful in a Java source file with nested inner classes. If the implementing check registers for any of the above tokens, the regular call to leaveToken(BinaryName, DetailAST) will be performed in addition to (before) this one.
        Parameters:
        pBinaryClassName - the binary class name of the visited type
        pAst - the token being completed
      • getCurrentBinaryName

        @CheckForNull
        protected BinaryName getCurrentBinaryName()
        Gets the binary name of the class currently being traversed on the AST. Normally, this is the single class in the .java file, but it could also be a (nested) named inner class. Whenever a new CLASS_DEF or similar token is visited, the result of this method would change.
        Returns:
        current binary name, or null if no CLASS_DEF or similar token has been encountered yet (e.g. while we are still going through the import statements)
      • getCurrentSimpleName

        @CheckForNull
        protected String getCurrentSimpleName()
        Gets the simple name of the current class, interface, annotation, or enum.
        Returns:
        the simple class name, or null if we are outside of a type definition
      • getMyPackage

        protected String getMyPackage()