This property encapsulates for each interface method those method that are potentially called by call-by-signature means only.
Determines for each method if it potentially can be directly called by a client.
Determines for each method if it potentially can be directly called by a client. This can happens if: - the method is directly visible to the client - the method can become visible by a visible subclass which inherits the respective method - the method can become pseudo-visible by a call on a superclass/interface (if the class is upcasted)
This property is computed on-demand by a direct property computation.
The common super trait of all entry point properties.
Common super trait of all factory method properties.
Identifies those fields that are immutable from the perspective of a client of a class/object - that is, whenever a field is (directly or indirectly (for example via a method call)) accessed after initialization it will see the same value.
Identifies those fields that are immutable from the perspective of a client of a class/object - that is, whenever a field is (directly or indirectly (for example via a method call)) accessed after initialization it will see the same value. From this description it follows that direct field read accesses are possible as long as the value is already finally initialized. In general it is even possible that the initializing field write is not done by the class itself but done by a specific caller that is guaranteed to be always executed before the field is (read) accessed elsewhere. Here, the initialization phase for a specific field always starts with the call of a constructor and ends when the field is set to some value (in a thread-safe manner) or the field is potentially read.
1. declared final
1. lazy initialized
0, 0l, 0f, 0d, null)1. effectively final
1. non-final
The field is only set once to a non-default value and only the updated value is used.
Determines for each method if it belongs to the public interface, hence, can be inherited by a future - yet unknown - subtype.
Determines for each method if it belongs to the public interface, hence, can be inherited by a future - yet unknown - subtype. Since this property is defined w.r.t. future subtyping it is only relevant when libraries are analyzed.
It specifies in particular whether a method can be inherited by a subtype that is created by some client of the library. When a method cannot be inherited by a future subtype is discussed in the following:
If an application is analyzed, this analysis does not make any sense since all used types are already known. Therefore, all applications methods should have the property NotInheritableByNewTypes.
inheritance is possible if: $ - if the method's visibility modifier is either public, protected or package visible $ - if the method's declaring class is not (effectively) final $ - CPA has to be applied to classes which are in the package "java.*"
Inheritance is possible if: $ - if the method's visibility modifier is public or protected $ - if the method's declaring class not is (effectively) final $ - if the method's declaring class is package visible and does not have a public subtype within the same package that inherits the method where the method is not overridden on the path from the declaring type to the public subtype
Notice that the packages "java.*" are closed, hence, nobody can contribute to this packages. Therefore, only public or protected methods where the declaring class is either public or the declaring class has a public subtype that does not override the method can have the property IsInheritableByNewTypes. Therefore, the closed packages assumption can always be applied to these packages.
The sound fallback of this property depends on the actual analysis mode under which the property is computed.
If the analysis mode is some application analysis mode (Desktop, J2EE etc.), the entity NotInheritableByNewTypes. If the analysis mode is some library analysis mode (CPA, OPA), the sound approximation is IsInheritableByNewTypes.
None.
This is a common trait for all Instantiability properties which can be emitted to the PropertyStore.
This is a common trait for all Instantiability properties which can be emitted to the PropertyStore. It describes the instantibility of a class entity.
The estimated complexity of a specific method.
The field is potentially updated multiple times.
Specifies the mutability of instances of a specific class.
Specifies the mutability of instances of a specific class. The highest rating is "Immutable", then "Conditionally Immutable", then "Mutable".
An instance of a class is rated as immutable if the state of does not change after initialization in a client visible manner! This includes all classes referenced by the instances (transitive hull). However, fields that are lazily initialized (in a thread-safe manner) and which don't change after that do not impede immutability. Conditionally immutable means that the state of the instance of the respective class cannot be mutated, but objects referenced by it can be mutated (so called immutable collections are typically rated as "conditionally immutable"). Mutable means that a client can mutate (directly or indirectly) the state of respective objects. In general the state of a class is determined w.r.t. the declared fields. I.e., an impure method which has, e.g., a call time dependent behavior because it uses the current time, but which does not mutate the state of the class does not affect the mutability rating. The same is true for methods with side-effects related to the state of other types of object.
The mutability assessment is by default done on a per class basis and only directly depends on the super class of the analyzed class. A rating that is based on all actual usages is only meaningful if we analyze an application. E.g., imagine a simple mutable data container class where no field – in the concrete context of a specific application – is ever updated.
A field that is initialized lazily in a thread-safe manner; i.e.,
which is set at most once after construction and which is always set to the
same value independent of the time of (lazy) initialization, may not affect the
mutability rating. However, an analysis may rate such a class as mutable. An
example of such a field is the field that stores the lazily calculated hashCode of
a String object.
java.lang.Object are immutable. However, if a class defines a
constructor which has a parameter of type object and which assigns the respective
parameter value to a field will at-most be conditionally immutable (instances of the
class object are immutable, but instances of the type (which includes all subtypes) are
not immutable; in general
we must assume that the referenced object may be (at runtime) some mutable object.Unknown native methods are considered as mutating the state unless all state is explicitly final; however, this is already handled by the org.opalj.fpcf.analysis.FieldMutabilityAnalysis.
Identifying real world immutable classes as such by means of an analysis is in general a challenging task. For example, to identify the well known immutable class "java.lang.String" as such requires:
Are not considered during the analysis as they are always immutable. (All fields are (implicitly)
static and final.)
This is a common trait for all ProjectAccessibility properties which can be emitted to the PropertyStore.
This is a common trait for all ProjectAccessibility properties which can be emitted to the PropertyStore. It describes the scope where the given entity can be accessed.
Common supertrait of all purity properties.
This property determines if an object leaks it's self reference (this) by passing
it to methods or assigning it to fields.
Specifies for each method the exceptions that are potentially thrown by the respective method.
Specifies for each method the exceptions that are potentially thrown by the respective method. This includes the set of exceptions thrown by called methods (if any). The property does not take the exceptions of methods which override the respective method into account. Nevertheless, in case of a method call all potential receiver methods are taken into consideration.
Note that it may be possible to compute some meaningful upper type bound for the set of
thrown exceptions even if methods are called for which the set of thrown exceptions is unknown.
This is generally the case if those calls are all done in a try block but the catch/finally
blocks only call known methods - if any.
An example is shown next and even if we assume that we don't know
the exceptions potentially thrown by Class.forName we could still determine that this method
will never throw an exception.
object Validator { def isAvailable(s : String) : Boolean = { try { Class.forName(s); true} finally {return false;} } }
This property describes if a type (class, interface) is further extensible by yet unknown types (that is, can be (transitively) inherited from).
This property describes if a type (class, interface) is further extensible by yet unknown types (that is, can be (transitively) inherited from). This property generally depends on the kind of the project. If the project is an application, all classes are considered to be closed unless we explicitly know that some specific classes/ interfaces are used in combination with class loading to load new (unknown) classes at runtime. I.e., the class hierarchy is basically considered to be fixed; if the analyzed project is a library then the result depends on the concrete assumption about the openness of the library.
A class is extensible if:
A class is extensible if:
If a class is defined in a package starting with java.*, it always has to be treated like
classes that are analyzed w.r.t. to closed-packages assumption. This is necessary because the
default ClassLoader prevents the definition of further classes within these packages, hence,
they are closed by definition.
If the analyzed codebase has an incomplete type hierarchy which leads to unknown subtype relationships, it is necessary to add these particular classes to the computed set of extensible classes.
Specifies if all instances of a respective type (this includes the instances of the type's subtypes) are (conditionally) immutable.
Specifies if all instances of a respective type (this includes the instances of the type's subtypes) are (conditionally) immutable. Conditionally immutable means that only the instance of the type itself is guaranteed to be immutable, but not all reachable objects. In general, all -- so called -- immutable collections are only conditionally immutable. I.e., the collection as a whole is only immutable if only immutable objects are stored in the collection. If this is not the case, the collection is only conditionally immutable.
This property is of particular interest if the precise type cannot be computed statically and basically depends on the AnalysisMode and ObjectImmutability.
Models the (intermediate) state when the analysis has determined that the class is at least conditionally immutable, but has not yet analyzed all dependencies and - therefore - cannot make a final decision whether the class is immutable.
Entities with PackageLocal project accessibility can be accessed by every entity within
the class where the entity is defined.
An instance of the respective class is effectively immutable.
An instance of the respective class is effectively immutable. I.e., after creation it is not possible for a client to set a field or to call a method that updates the internal state
Used if we know that the pureness of a methods only depends on the pureness of the target methods.
Used if we know that the pureness of a methods only depends on the pureness of the target methods.
A method calling a ConditionallyPure method can at most be ConditionallyPure itself, unless ConditionallyPure is refined to Pure.
A companion object for the ProjectAccessibility trait.
A companion object for the ProjectAccessibility trait. It holds the key, which is shared by all properties derived from the ProjectAccessibility property, as well as it defines defines the (sound) fall back if the property is not computed but requested by another analysis.
Entities with Global project accessibility can be accessed by every entity within the project.
An instance of the respective class is effectively immutable and also all reference objects.
An instance of the respective class is effectively immutable and also all reference objects. I.e., after creation it is not possible for a client to set a field or to call a method that updates the internal state of the instance or an object referred to by the instance in such a way that the client can observe the state change.
An instance of the respective class is effectively immutable.
An instance of the respective class is effectively immutable. I.e., after creation it is not possible for a client to set a field or to call a method that updates the internal state
The respective method is impure.
A companion object for the Instantiability trait.
A companion object for the Instantiability trait. It holds the key, which is shared by all properties derived from the Instantiability property, as well as it defines defines the (sound) fall back if the property is not computed but requested by another analysis.
Should be assigned to classes which can be instantiated or are instantiated.
The respective method is an entry point.
The respective method is a factory method.
Classes that are MaybeInstantiable lack of information.
Classes that are MaybeInstantiable lack of information. E.g. we don't know whether it is instantiable or not.
The fallback/default purity.
The fallback/default purity.
It is only used by the framework in case of a dependency on an element for which no result could be computed.
The respective method is not an entry point.
The respective method is not a factory method.
NotInstantiable should be used for not instantiable classes.
NotInstantiable should be used for not instantiable classes.
public class Foo { private Foo(){} }
Foo is not instantiable because it can not be instantiated except by Foo itself which does never call the private constructor.
Common constants use by all ObjectImmutability properties associated with methods.
Entities with PackageLocal project accessibility can be accessed by every entity within
the package where the entity is defined.
The respective method is pure.
A very straight forward flow-insensitive analysis which can successfully analyze methods
with respect to the potentially thrown exceptions under the conditions that no other
methods are invoked and that no exceptions are explicitly thrown (ATHROW).
A very straight forward flow-insensitive analysis which can successfully analyze methods
with respect to the potentially thrown exceptions under the conditions that no other
methods are invoked and that no exceptions are explicitly thrown (ATHROW). This analysis
always computes a sound over approximation of the potentially thrown exceptions.
The analysis has limited support for the following cases to be more precise in case of common code patterns (e.g., a standard getter):
IllegalMonitorStateExceptions.Hence, the primary use case of this method is to identify those methods that are guaranteed to never throw exceptions.
Common constants use by all TypeImmutability properties associated with methods.
This property encapsulates for each interface method those method that are potentially called by call-by-signature means only. Since the property assumes that the current codebase can be extended, it does not make sense to compute this property when a closed-world program/whole application is analyzed.
When an incomplete application or library is analyzed the unknown code could contain subtypes that introduce valid call edges within the known code base. This is in particular the case when it exists an interface and a - from the interface independent - class within the codebase which share a method with the same signature. The unknown codebase could contain a subtype which extends both the class and the interface but does not override the method. If there exists a call on an interface method which fulfills the previously described scenario the method of the class becomes a possible call target even if it does not implement the interface. The following example illustrates this case:
Fallback
The CallBySignature property has only a save fallback in the closed-world application scenario where the codebase can not be extended. Hence, in this case it is save to yield NoCBSTargets as fallback. In any other case there is no save fallback. Due to the unavailability of a save fallhback a very simple computation is triggered that returns either NoCBSTargets if no call-by-signature targets could be found and CBSTargets if a sound approximation of possible call-by-signature targets could be found. This computation returns all possible call targets that fulfill the following criteria:
Cycle Resolution Strategy
This property does not depend on other entities since there can not be any cycles.