Class CheckTool

  • Direct Known Subclasses:
    CheckToolWithAnalysisResults

    public class CheckTool
    extends java.lang.Object
    An auxiliary tool that can be used by checks during their execution. It provides reporting capabilities, as well as access to analysis singletons, such as executed semantic analyses.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        CheckTool()
      Build the tool.
      protected CheckTool​(CheckTool other)
      Build the tool, shallow-copying the set of warnings from the given one.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<Warning> getWarnings()
      Returns an unmodifiable view of the warnings that have been generated up to now using this tool.
      void warn​(java.lang.String message)
      Reports a new warning that is meant to be a generic warning on the program.
      void warnOn​(CFGDescriptor descriptor, java.lang.String message)
      Reports a new warning with the given message on the declaration of the cfg represented by the given descriptor.
      void warnOn​(CFG cfg, java.lang.String message)
      Reports a new warning with the given message on the declaration of the given cfg.
      void warnOn​(Expression expression, java.lang.String message)
      Reports a new warning with the given message on the given expression.
      void warnOn​(Statement statement, java.lang.String message)
      Reports a new warning with the given message on the given statement.
      void warnOn​(Unit unit, Global global, java.lang.String message)
      Reports a new warning with the given message on the declaration of the given global.
      void warnOn​(Unit unit, java.lang.String message)
      Reports a new warning with the given message on the declaration of the given unit.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CheckTool

        public CheckTool()
        Build the tool.
      • CheckTool

        protected CheckTool​(CheckTool other)
        Build the tool, shallow-copying the set of warnings from the given one.
        Parameters:
        other - the original tool to copy
    • Method Detail

      • warn

        public void warn​(java.lang.String message)
        Reports a new warning that is meant to be a generic warning on the program. For warnings related to one of the components of the program (e.g., a CFG, a statement, ...) rely on the other methods provided by this class.
        Parameters:
        message - the message of the warning
      • warnOn

        public void warnOn​(Unit unit,
                           java.lang.String message)
        Reports a new warning with the given message on the declaration of the given unit.
        Parameters:
        unit - the unit to warn on
        message - the message of the warning
      • warnOn

        public void warnOn​(Unit unit,
                           Global global,
                           java.lang.String message)
        Reports a new warning with the given message on the declaration of the given global.
        Parameters:
        unit - the unit containing the global to warn on
        global - the global to warn on
        message - the message of the warning
      • warnOn

        public void warnOn​(CFG cfg,
                           java.lang.String message)
        Reports a new warning with the given message on the declaration of the given cfg.
        Parameters:
        cfg - the cfg to warn on
        message - the message of the warning
      • warnOn

        public void warnOn​(CFGDescriptor descriptor,
                           java.lang.String message)
        Reports a new warning with the given message on the declaration of the cfg represented by the given descriptor.
        Parameters:
        descriptor - the descriptor cfg to warn on
        message - the message of the warning
      • warnOn

        public void warnOn​(Statement statement,
                           java.lang.String message)
        Reports a new warning with the given message on the given statement. If statement is an instance of Expression, then warnOn(Expression, String) is invoked.
        Parameters:
        statement - the statement to warn on
        message - the message of the warning
      • warnOn

        public void warnOn​(Expression expression,
                           java.lang.String message)
        Reports a new warning with the given message on the given expression.
        Parameters:
        expression - the expression to warn on
        message - the message of the warning
      • getWarnings

        public java.util.Collection<Warning> getWarnings()
        Returns an unmodifiable view of the warnings that have been generated up to now using this tool.
        Returns:
        a view of the warnings