Mixed in by domains that support the conversation of a Java Object into a DomainValue
.
Mixed in by domains that support the conversation of a Java Object into a DomainValue
.
AsJavaObject for further information on limitations.
Mixed in by domains that support the conversation of a DomainValue
into
a respective Java object.
Mixed in by domains that support the conversation of a DomainValue
into
a respective Java object. This Java object can then be used to perform method
invocations.
Using AsJavaObject
will only work reasonably iff the respective class
is either in the classpath of the JVM or a class loader (initialized with the
project's classpath) is used.
The latter, however, does not work for classes on the bootclasspath (e.g.,
java.lang.String
). In that case it is necessary to check that the code of the
analyzed application is compatible with the one on the class path.
To avoid accidental imprecision in the analysis you should use this features
only for stable classes belonging to the core JDK (java.lang...
.)
Provides information about an integer value's precise value, if this information is available.
Provides information about an integer value's precise value, if this information is available.
This functionality is not required by the OPAL core.
,The information about an integer value's range that is required by the
abstract interpreter is defined by the Domain
trait.
Provides information about a long value's precise value, if this information is available.
Provides information about a long value's precise value, if this information is available.
This abstract interpreter never requires knowledge about the precise
value of a value with computational type long
.
Resolves references to final static fields that have simple constant values.
Resolves references to final static fields that have simple constant values.
A typical Java compiler automatically resolves all simple references and, hence, this trait has for Java projects in general no effect. If we analyze other languages that compile to the JVM platform, the effect might be different.
Provides information about the code block that is currently analyzed.
Provides information about the code block that is currently analyzed.
Final binding of a Domain
's type DomainValue
as well as all subtypes of it that are
also defined by Domain
.
Final binding of a Domain
's type DomainValue
as well as all subtypes of it that are
also defined by Domain
.
The type DomainValue
is set to the type org.opalj.ai.Domain.Value.
Default implementation of the ExceptionsFactory trait that relies on the ReferenceValuesFactory.
Provides default implementations for a Domain
's return methods that always throw
an IllegalMonitorStateExceptoin
.
Provides default implementations for a Domain
's return methods that always throw
an IllegalMonitorStateExceptoin
.
You can mix in this trait if you are not interested in a method's return values or if you need some default implementations.
Basic implementation of a Domain
's abruptMethodExecution
method that does
nothing.
Basic implementation of a Domain
's abruptMethodExecution
method that does
nothing.
Mix-in this trait if the analysis does not need to do anything special in case of an exception or if you have multiple stackable traits and you need a base implementation. Example:
MySpecialDomain extends ... with DefaultHandlingForThrownExceptions with RecordThrownExceptions with ...
A Domain
that does nothing if a method returns ab-/normally.
A Domain
that does nothing if a method returns ab-/normally.
This trait's methods are generally not intended to be overridden. If you need to do some special processing just directly implement the respective method and mixin the traits that ignore the rest.
Basic implementation of a Domain
s returnVoid
method that does nothing.
Records the results of the evaluation of the current
method such that the results
can directly be adapted to the calling context and can be used by the caller to continue
the abstract interpretation of the calling method.
Common super trait of all domains have an id to identify them.
Encapsulates a domain
and some values created by the respective domain.
Encapsulates a domain
and some values created by the respective domain.
Using the class DomainValues
enables type-safety when we need to store and
pass on a Domain
object and some of its values.
This (partial-)domain abstracts over the concrete methods for performing array operations and provides an interface at a higher abstraction level.
Provides a default implementation for the instructions related to synchronization.
Thrown to indicate that a refinement of some value was not possible.
Provides log context information.
Trait that can be mixed in if information is needed about all returned values and the thrown exceptions.
Trait that can be mixed in if information is needed about all returned values and the thrown exceptions. This information is, however, only available after the evaluation of a method has completed.
Support for handling method invocations.
Tracks if a monitor(enter|exit) instruction was executed.
Tracks if a monitor(enter|exit) instruction was executed.
This knowledge is of interest to decide, e.g., whether a return instruction
may throw an IllegalMonitorStateException
or not.
Provides information about the origin of a value.
Provides information about the origin of a value.
To get origin information this trait needs be implemented by a domain. I.e., just mixing in this trait will not provide origin information about values.
This trait should be inherited from by all domains that make information about the origin of a value available (see org.opalj.ai.domain.l1.ReferenceValues as an example).
Provides the generic infrastructure to register a function that updates the operands and locals associated with an instruction that will be evaluated "next".
Provides the generic infrastructure to register a function that updates the operands and locals associated with an instruction that will be evaluated "next". For example, let's assume that we are currently processing instruction X and that instruction Y is the successor instruction. In this case, the framework will first determine the effect of function X on the stack/locals. After that, all registered updaters will be called. All registered updaters will be discarded as soon the evaluation of instruction X has completed.
Provides the possibility to further update the memory layout (registers and operands) after the execution of an instruction, but before any potential join is performed.
Provides the possibility to further update the memory layout (registers and operands) after the execution of an instruction, but before any potential join is performed.
If this domain is mixed in then the domain cannot be used to simultaneously analyze multiple different methods at the same time.
This class uses OPAL's preInitializedClassHierarchy
(see ClassHierarchy
for details)
for class hierarchy related queries.
This class uses OPAL's preInitializedClassHierarchy
(see ClassHierarchy
for details)
for class hierarchy related queries.
Use this trait ONLY if you just want to do some testing.
Records all exceptions thrown by a method.
Records all exceptions thrown by a method. I.e., for each instruction that throws an exception (or multiple exceptions) all exceptions are recorded.
This domain is only effective if the calculation of joins is fast. Otherwise it can significantly hamper overall performance!
,This domain requires that DomainValue
s that represent thrown exceptions
have meaningful equals
and hashCode
methods. (Depending on the purpose
of the abstract interpretation, reference equality may be sufficient.)
Records the abstract interpretation time control-flow graph (CFG).
Records the abstract interpretation time control-flow graph (CFG). This CFG is always (still) a sound approximation of the generally incomputable real CFG.
This domain overrides the flow
method and requires that it is mixed in before every
other domain that overrides the flow
method and which may manipulate the worklist
.
E.g., the mixin order should be:
class MyDomain extends Domain with RecordCFG with FlowManipulatingDomain
If the mixin order is not correct, the CFG may not be complete/concrete.
initProperties
.Mixin this trait if you want to reify the constraints that are stated by the abstract interpretation framework.
Mixin this trait if you want to reify the constraints that are stated by the abstract interpretation framework. This is particularly useful for testing and debugging purposes.
Collects the abstract interpretation time definition/use information.
Collects the abstract interpretation time definition/use information.
I.e., makes the information available which value is accessed where/where a used
value is defined.
In general, all local variables are identified using Int
s
where the Int
identifies the expression (by means of it's pc) which evaluated
to the respective value. In case of a parameter the Int
value is equivalent to
the value -parameterIndex
.
In case of exception values the Int
value identifies the exception
handler that caught the respective exception. This information can then be used –
in combination with the AICFG - to identify the origin instruction that caused
the exception. A more precise propagation of def/use information related to exceptions is
– as part of this very generic domain – not possible. If we would propagate def-use
information beyond the handler, we would not be able to distinguish between the handlers
anymore and therefore we would not be able to identify where a caught exception is eventually
used.
This trait finalizes the collection of the def/use information after the abstract interpretation has successfully completed and the control-flow graph is available. The information is automatically made available, when this plug-in is mixed in.
The parameters given to a method have negative int
values (the first
parameter has the value -1, the second -2 if the first one is a value of computational
type category one and -3 if the first value is of computational type category two and so forth).
I.e., in case of a method def (d : Double, i : Int)
, the second parameter will have the index
-3.
An instance of this domain can be reused to successively perform abstract
interpretations of different methods.
The domain's inherited initProperties
method – which is always called by the AI
framework – resets the entire state related to the method.
Records the exception that is thrown by an instruction.
Records the exception that is thrown by an instruction. If an instruction throws
multiple exceptions. The exceptions are join
ed using the Domain#DomainValue's
join
method.
This trait can be used to record the thrown exceptions independently of the precision of the domain.
Records the last value that is returned by a specific return instruction.
Records the last value that is returned by a specific return instruction.
Recording just the last value that is returned by a (a|i|l|f|d)return
instruction
is often sufficient (e.g., in case of a domain that performs all computations at the type
level). The "last" value encodes all necessary information.
Records the results of the evaluation of the current
method such that the results
can directly be adapted to the calling context and can be used by the caller to continue
the abstract interpretation of the calling method.
Records the program counters of all instructions that lead to a (ab)normal return from the method.
Records the program counters of all instructions that lead to a (ab)normal
return from the method. I.e., every instruction that may throw an exception or
causes a normal return from method may be recorded. Examples of instructions
that may be recorded: (X)return
, throw
, invoke(XXX)
, get|put(static|field)
,
checkcast
, (a)new(array)
,... . Instructions such as swap
or dup(XXX)
, however,
never directly lead to a method return (they will never result in an exception)
and will not be recorded.
If you are interested in recording the values use: RecordReturnedValues, RecordThrownExceptions.
This domain can be stacked on top of other traits that handle return instructions and abrupt method executions.
Record the value returned by a method across all return instructions.
Record the value returned by a method across all return instructions.
This domain can be stacked on top of other traits that handle return instructions that return some value.
A domain that mixes in this trait should only be used to analyze a single method.
Generic infrastructure to record the value returned by the method (calculated across all return instructions)
Generic infrastructure to record the value returned by the method (calculated across all return instructions)
This domain can be stacked on top of other traits that handle return instructions that return some value.
A domain that mixes in this trait should only be used to analyze a single method.
Generic infrastructure to record the values returned by the method.
Generic infrastructure to record the values returned by the method. (Note that the computational type of the value(s) is not recorded. It is directly determined by the signature of the method that is analyzed or can be extracted using the respective method.)
This domain can be stacked on top of other traits that handle return instructions that return some value.
A domain that mixes in this trait should only be used to analyze a single method.
Infrastructure to record returned values.
Generic infrastructure to record the exceptions thrown by a method.
Generic infrastructure to record the exceptions thrown by a method. This trait can be used to record the thrown exceptions independently of the precision of the domain.
This domain can be stacked on top of other traits that handle abruptMethodExecutions.
Records the program counters of all return (void) instructions that are reached.
Records the program counters of all return (void) instructions that are reached.
Typical usage:
class MyDomain extends ...DefaultHandlingOfVoidReturns with RecordVoidReturns
This domain forwards all instruction evaluation calls to the super trait.
Mixin this trait to reify the stated constraints.
Mixin this trait to reify the stated constraints. This trait need to be mixed in after all traits that actually handle constraints.
This is particularly useful for testing and debugging purposes.
Adds support for handling return instructions in a generic manner.
Hard-codes some part of the semantics of some very high-profile (native) methods of the JDK
(for example, System.arraycopy
).
Hard-codes some part of the semantics of some very high-profile (native) methods of the JDK
(for example, System.arraycopy
).
This method should be mixed in (lexically) after those domains that provide the basic handling of unresolved methods (e.g., using "just" type information) but before those that actually invoke a method!
Provides information about the code block that is currently analyzed.
Provides information about the code block that is currently analyzed.
Provides information about the method that is currently analyzed.
Provides information about the method that is currently analyzed.
A domain that implements this trait usually defines a parameter that is set at construction time.
E.g.,
class MyDomain{val method : Method} extends Domain with TheMethod
Provides information about the underlying project.
Provides information about the underlying project.
If a (partial-) domain needs information about the project declare a corresponding self-type dependency.
trait MyIntegerValuesDomain extends IntegerValues { this : TheProject =>
A domain that provides information about the currently analyzed project should inherit from this trait and implement the respective method.
It is recommended that the domain that provides the project information
does not use the override
access flag.
This way the compiler will issue a warning if two implementations are used
to create a final domain.
This trait is mixed in by those (partial) domains that require access to the project's property store.
A configuration that forces abstract interpretation to always create an exception if it is not possible to deduce that a specific exception will not be thrown.
A configuration that forces abstract interpretation to always create an exception if it is not possible to deduce that a specific exception will not be thrown.
If you need to adapt a setting just override the respective method in your domain or create a class that inherits from Configuration.
A configuration that forces abstract interpretation to never create an exception if it is not possible to deduce that the specific exception is guaranteed to be thrown.
A configuration that forces abstract interpretation to never create an exception if it is not possible to deduce that the specific exception is guaranteed to be thrown.
If you need to adapt a setting just override the respective method in your domain or create a class that inherits from Configuration.
Can be mixed in to create a Domain
that is intended to be used to coordinate the
exchange of values between different domains.
Can be mixed in to create a Domain
that is intended to be used to coordinate the
exchange of values between different domains.
This domain does not prescribe the semantics of any values, but instead implements methods that perform computations.
This domain directly inherits from Domain and can, thus, directly be used to create a final domain.
Factory for creating DomainValues
objects.
A base abstract interpreter that can be used with any domain that has no special requirements on the abstract interpreter and which provides some convenience factory methods to run the abstract interpretation if the domain provide the necessary information.
A base abstract interpreter that can be used with any domain that has no special requirements on the abstract interpreter and which provides some convenience factory methods to run the abstract interpretation if the domain provide the necessary information.
The base interpreter can be interrupted by calling the interrupt
method of the
AI's thread.
BoundedInterruptableAI for an abstract interpreter that can easily be interrupted and which also interrupts itself if a certain threshold is exceeded.
Tries to determine the name of the method/class that is analyzed; the result depends on the mixed-in domain.
Commonly useful methods.
This package contains definitions of common domains that can be used for the implementation of analyses.
Types of Domains
In general, we distinguish two types of domains. First, domains that define a general interface (on top of the one defined by Domain), but do not directly provide an implementation. Hence, whenever you develop a new
Domain
you should consider implementing/using these domains to maximize reusability. Second,Domain
s that implement a specific interface (trait). In this case, we further distinguish between domains that provide a default implementation (per interface only one of theseDomain
s can be used to create a finalDomain
) and those that can be stacked and basically refine the overall functionality.Examples
Domain
's respective methods. However, it does provide a default implementation. Hence, a typical pattern is:Thread Safety
Unless explicitly documented, a domain is never thread-safe. The general programming model is to use one
Domain
object per code block/method and therefore, thread-safety is not required forDomain
s that are used for the evaluation of methods. However domains that are used to adapt/transfer values should be thread safe (see ValuesCoordinatingDomain for further details).