This analysis computes the CallBySignature property.
This Analysis determines the ´ClientCallable´ property of a method.
This Analysis determines the ´ClientCallable´ property of a method. A method is considered as leaked if it is overridden in every immediate non-abstract subclass.
In the following scenario, m defined by B overrides m in C and (in this specific scenario) m in C is also always overridden.
/*package visible*/ class C { public Object m() } /*package visible*/ abstract class A extends C { /*empty*/ } public class B extends A { public Object m() }
A shallow analysis that determines for each new object that is created within a method if it escapes the scope of the method.
A shallow analysis that determines for each new object that is created within a method if it escapes the scope of the method.
An object escapes the scope of a method if:
this) by:this in some static field or,This analysis can be used as a foundation for an analysis that determines whether all instances created for a specific class never escape the creating method and, hence, respective types cannot occur.
This analysis identifies a project's factory methods.
This analysis identifies a project's factory methods.
A method is no factory method if:
This information is relevant in various contexts, e.g., to determine the instantiability of a class.
Use the FPCFAnalysesManagerKey to query the analysis manager of a project. You can run the analysis afterwards as follows:
val analysisManager = project.get(FPCFAnalysisManagerKey)
analysisManager.run(FactoryMethodAnalysis)For detailed information see the documentation of the analysis manager.
The results of this analysis are stored in the property store of the project. You can receive the results as follows:
val theProjectStore = theProject.get(SourceElementsPropertyStoreKey) val factoryMethods = theProjectStore.entities { (p: Property) ⇒ p == IsFactoryMethod }
Native methods are considered as factory methods because they might instantiate the class.
Determines if a field is always initialized at most once or if a field is or can be mutated after (lazy) initialization.
This analysis computes the InheritableByNewTypes property.* I.e., it determines whether a method can directly be inherited by a future subtype.
This analysis computes the InheritableByNewTypes property.* I.e., it determines whether a method can directly be inherited by a future subtype. This is in particular important when analyzing libraries.
The analysis assumes that packages that start with "java." are closed, i.e., that no client can put a class into these specific packages.
Use the FPCFAnalysesManagerKey to query the analysis manager of a project. You can run the analysis afterwards as follows:
val analysisManager = project.get(FPCFAnalysisManagerKey)
analysisManager.run(InheritableByNewSubtypesAnalysis)For detailed information see the documentation of the analysis manager.
The results of this analysis are stored in the property store of the project. You can receive the results as follows:
val thePropertyStore = theProject.get(SourceElementsPropertyStoreKey) val property = thePropertyStore(method, InheritableByNewTypes.Key) property match { case Some(IsInheritableByNewTypes) => ... case Some(NotInheritableByNewTypes) => ... case None => ... // this happens only if a not supported entity is passed to the computation. }
This analysis computes the org.opalj.fpcf.properties.InheritableByNewTypes property. Since this makes only sense when libraries are analyzed, using the application mode will result in the org.opalj.fpcf.properties.NotInheritableByNewTypes for every given entity.
This analysis considers all scenarios that are documented by the org.opalj.fpcf.properties.InheritableByNewTypes property.
This analysis implements a direct property computation that is only executed when required.
Determines the mutability of instances of a specific class.
Determines the mutability of instances of a specific class. In case the class is abstract the (implicit) assumption is made that all abstract methods (if any) are/can be implemented without necessarily/always requiring additional state; i.e., only the currently defined fields are take into consideration. An interfaces is always considered to be immutable. If you need to know if all possible instances of an interface or some type; i.e., all instances of the classes that implement the respective interface/inherit from some class are immutable, you can query the org.opalj.fpcf.properties.TypeImmutability property.
In case of incomplete class hierarchies or if the class hierarchy is complete, but some class files are not found the sound approximation is done that the respective classes are mutable.
This analysis uses the org.opalj.fpcf.properties.FieldMutability property to determine those fields which could be final, but which are not declared as final.
This analysis determines whether a method is pure.
This analysis determines whether a method is pure. I.e., whether the method only operates on the given state (i.e., the method is pure) or depends on other state/mutable global state; the given state may include the state of the current object that is the receiver of the call if the object/receiver is immutable.
This analysis follows the definition found on wikipedia:
[...] a function may be considered a pure function if both of the following statements about the function hold:
Hence, using true constants (e.g., Math.e) is not a problem as well as creating intermediate (mutable) data structures. Furthermore, instance method based calls can also be pure if the receiving object is (effectively final) or was created as part of the evaluation of the method.
This analysis determines which classes can never be instantiated (e.g.,
java.lang.Math).
This analysis determines which classes can never be instantiated (e.g.,
java.lang.Math).
A class is not instantiable if:
The analysis does not take reflective instantiations into account!
,This analysis depends on the project configuration which encodes the analysis mode. Different analysis modes are: library with open or closed packages assumption or application This information is relevant in various contexts, e.g., to determine precise call graph. For example, instance methods of those objects that cannot be created are always dead.
Use the FPCFAnalysesManagerKey to query the analysis manager of a project. You can run the analysis afterwards as follows:
val analysisManager = project.get(FPCFAnalysisManagerKey)
analysisManager.run(InstantiabilityAnalysis)For detailed information see the documentation of the analysis manager. The results of this analysis are stored in the property store of the project. You can receive the results as follows:
val theProjectStore = theProject.get(SourceElementsPropertyStoreKey) val instantiableClasses = theProjectStore.entities { (p: Property) ⇒ p == Instantiable }
This information is relevant in various contexts, e.g., to determine precise call graph. For example, instance methods of those objects that cannot be created are always dead.
Determines if a class is extensible (i.e., can be inherited from).
Determines if a class is extensible (i.e., can be 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; i.e., the class hierarchy is 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.
However, package visible classes in packages starting with "java." are always treated as not
client extensible as this would require that those classes are defined in the respective
package which is prevented by the default ClassLoader in all cases.
Since the computed property is a set property, other analyses have to wait till the property is computed.
Determines the mutability of a specific type.
Companion object for the FactoryMethodAnalysis class.
Companion object for the MethodAccessibilityAnalysis class.
Runs an immutability analysis to determine the mutability of objects.
Companion object for the SimpleInstantiabilityAnalysis class.
Companion object for the StaticMethodAccessibilityAnalysis class.
Starter for the type immutability analysis.
This analysis computes the CallBySignature property. I.e., it determines the call-by-signature targets of an interface method.
It is in particular relevant when analyzing software libraries and not whole applications, since applications cannot be extended anymore w.r.t. to subtyping.
This analysis implements a direct property computation that is only executed when required.