Class Throw
- java.lang.Object
-
- it.unive.lisa.program.cfg.statement.Statement
-
- it.unive.lisa.program.cfg.statement.UnaryStatement
-
- it.unive.lisa.program.cfg.statement.Throw
-
- All Implemented Interfaces:
ProgramPoint,CodeElement,Node<Statement,Edge,CFG>,java.lang.Comparable<Statement>
public class Throw extends UnaryStatement
A statement that raises an error, stopping the execution of the current CFG and propagating the error to among the call chain.
-
-
Constructor Summary
Constructors Constructor Description Throw(CFG cfg, CodeLocation location, Expression expression)Builds the throw, raisingexpressionas error, happening at the given location in the program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>>
AnalysisState<A,H,V>semantics(AnalysisState<A,H,V> entryState, InterproceduralAnalysis<A,H,V> interprocedural, StatementStore<A,H,V> expressions)Computes the semantics of the statement, expressing how semantic information is transformed by the execution of this statement.booleanstopsExecution()Whether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value.booleanthrowsError()Whether or not this statement throws an error, halting the normal execution of the containing cfg.java.lang.StringtoString()-
Methods inherited from class it.unive.lisa.program.cfg.statement.UnaryStatement
accept, equals, getExpression, hashCode, setOffset
-
Methods inherited from class it.unive.lisa.program.cfg.statement.Statement
compareTo, getCFG, getLocation, getOffset
-
-
-
-
Constructor Detail
-
Throw
public Throw(CFG cfg, CodeLocation location, Expression expression)
Builds the throw, raisingexpressionas error, happening at the given location in the program.- Parameters:
cfg- the cfg that this statement belongs tolocation- the location where the expression is defined within the source file. If unknown, usenullexpression- the expression to raise as error
-
-
Method Detail
-
stopsExecution
public boolean stopsExecution()
Description copied from class:StatementWhether or not this statement stops the execution of the containing cfg, either by throwing an error or returning a value. To distinguish error-raising halting statements and normal ones, useStatement.throwsError().- Overrides:
stopsExecutionin classStatement- Returns:
trueonly if that condition holds
-
throwsError
public boolean throwsError()
Description copied from class:StatementWhether or not this statement throws an error, halting the normal execution of the containing cfg.- Overrides:
throwsErrorin classStatement- Returns:
trueonly if that condition holds
-
semantics
public <A extends AbstractState<A,H,V>,H extends HeapDomain<H>,V extends ValueDomain<V>> AnalysisState<A,H,V> semantics(AnalysisState<A,H,V> entryState, InterproceduralAnalysis<A,H,V> interprocedural, StatementStore<A,H,V> expressions) throws SemanticException
Description copied from class:StatementComputes the semantics of the statement, expressing how semantic information is transformed by the execution of this statement. This method is also responsible for recursively invoking theStatement.semantics(AnalysisState, InterproceduralAnalysis, StatementStore)of each nestedExpression, saving the result of each call inexpressions.- Specified by:
semanticsin classStatement- Type Parameters:
A- the type ofAbstractStateH- the type of theHeapDomainV- the type of theValueDomain- Parameters:
entryState- the entry state that represents the abstract values of each program variable and memory location when the execution reaches this statementinterprocedural- the interprocedural analysis of the program to analyzeexpressions- the cache where analysis states of intermediate expressions must be stored- Returns:
- the
AnalysisStaterepresenting the abstract result of the execution of this statement - Throws:
SemanticException- if something goes wrong during the computation
-
-