Package

org.opalj.fpcf

properties

Permalink

package properties

Visibility
  1. Public
  2. All

Type Members

  1. sealed class AllThrownExceptions extends ThrownExceptions

    Permalink
  2. case class CBSTargets(cbsTargets: Set[Method]) extends CallBySignature with Product with Serializable

    Permalink
  3. sealed trait CallBySignature extends Property

    Permalink

    This property encapsulates for each interface method those method that are potentially called by call-by-signature means only.

    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:

    /* Known codebase */
    
    public interface Logger {
      public void log();
    }
    
    public class ConcreteLogger {
      public void log(){ /* */} // this method becomes a call target of an interface invocation because of the ApplicationLogger class
    }
    
      /* unknown/hypothetical codebase */
    
    public class ApplicationLogger extends ConcreteLogger implements Logger {
      // if the log method of the interface is invoked the log method of ConcreteLogger is called.
    }

    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:

    • the respective method has to be concrete
    • the respective method need the access flag public
    • the declaring class of the respective method allows inheritance (it is not (effectively) final)
    • the declaring class of the respective method does not implement interface where the given method is defined
    • if it can not be determined whether the declaring class is a subtype of the interface, the respective method is included in the set of potential call-by-signature targets

    Cycle Resolution Strategy

    This property does not depend on other entities since there can not be any cycles.

  4. sealed trait ClientCallable extends Property

    Permalink

    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)

    Note

    This property is computed on-demand by a direct property computation.

  5. sealed trait EntryPoint extends Property

    Permalink

    The common super trait of all entry point properties.

  6. sealed trait FactoryMethod extends Property with FactoryMethodPropertyMetaInformation

    Permalink

    Common super trait of all factory method properties.

  7. sealed trait FactoryMethodPropertyMetaInformation extends PropertyMetaInformation

    Permalink
  8. sealed trait FieldMutability extends Property with FieldMutabilityPropertyMetaInformation

    Permalink

    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.

    Property manifestations

    1. declared final

    • actually directly declared as final

    1. lazy initialized

    • all field writes and reads have to be known
      • OPA: all private fields
      • CPA: all private and package private fields and all protected and public fields that are not accessible by a client
      • APP: all fields
    • all writes have to be guarded by a test if the field still has the default value
    • all reads happen after initialization of the field and are either also guarded by test or happen directly after a field write
    • the field is set at most once to a value that is not the default value (0, 0l, 0f, 0d, null)

    1. effectively final

    • all criteria of the lazy initialized field have to hold (see previous section)
    • all reads and writes have to be guarded by the same (synchronization) lock.

    1. non-final

    • a field is non final if non of the the previous cases holds
    • e.g. not all reads and writes of the field are known
  9. sealed trait FieldMutabilityPropertyMetaInformation extends PropertyMetaInformation

    Permalink
  10. sealed trait FinalField extends FieldMutability

    Permalink

    The field is only set once to a non-default value and only the updated value is used.

  11. sealed trait InheritableByNewTypes extends Property

    Permalink

    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:

    Inheritance w.r.t. Applications

    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 w.r.t. Open Packages Assumption

    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 w.r.t. Closed Packages Assumption

    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

    Special Cases

    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.

    Fallback

    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.

    Cycle Resolution Strategy

    None.

  12. sealed trait Instantiability extends Property with InstantiabilityPropertyMetaInformation

    Permalink

    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.

  13. sealed trait InstantiabilityPropertyMetaInformation extends PropertyMetaInformation

    Permalink
  14. sealed trait InterfaceForNewSubtypes extends InheritableByNewTypes

    Permalink
  15. case class MethodComplexity(value: Int) extends Property with MethodComplexityPropertyMetaInformation with Product with Serializable

    Permalink

    value

    The estimated complexity of a specific method.

  16. sealed trait MethodComplexityPropertyMetaInformation extends PropertyMetaInformation

    Permalink
  17. sealed trait MutableObject extends ObjectImmutability

    Permalink
  18. final case class NoExceptionsAreThrown(explanation: String) extends AllThrownExceptions with Product with Serializable

    Permalink
  19. sealed trait NonFinalField extends FieldMutability

    Permalink

    The field is potentially updated multiple times.

  20. sealed trait ObjectImmutability extends OrderedProperty with ObjectImmutabilityPropertyMetaInformation

    Permalink

    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.

    Thread-safe Lazily Initialized Fields

    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.

    Inheritance

    • Instances of 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.
    • In general, only classes that inherit from (conditionally) immutable class can be (conditionally) immutable; if a class is mutable, all subclasses are also considered to be mutable. I.e., a subclass can never have a higher mutability rating than a superclass.
    • All classes for which the superclasstype information is not complete are rated as unknown. (Interfaces are generally ignored as they are always immutable.)

    Native Methods

    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 Immutable Objects in Practice

    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:

    • Identifying that the field hash is effectively immutable though the field is only lazily initialized (in a thread-safe manner).
    • Determing that all calls to the package-private constructor java.lang.String(byte[] buf, Boolean shared) are actually passed an array that is not shared afterwards. I.e., the ownership is in all cases effectively transfered to the class java.lang.String.

    Interfaces

    Are not considered during the analysis as they are always immutable. (All fields are (implicitly) static and final.)

  21. sealed trait ObjectImmutabilityPropertyMetaInformation extends PropertyMetaInformation

    Permalink
  22. sealed trait ProjectAccessibility extends Property

    Permalink

    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.

  23. sealed abstract class Purity extends Property with PurityPropertyMetaInformation

    Permalink

    Common supertrait of all purity properties.

  24. sealed trait PurityPropertyMetaInformation extends PropertyMetaInformation

    Permalink
  25. sealed trait SelfReferenceLeakage extends Property

    Permalink

    This property determines if an object leaks it's self reference (this) by passing it to methods or assigning it to fields.

  26. sealed abstract class ThrownExceptions extends Property

    Permalink

    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;}
     }
    }
  27. final case class ThrownExceptionsAreUnknown(reason: String) extends ThrownExceptions with Product with Serializable

    Permalink
  28. class ThrownExceptionsFallbackAnalysis extends PropertyComputation[Method]

    Permalink
  29. sealed abstract class TypeExtensibility extends Property with TypeExtensibilityPropertyMetaInformation

    Permalink
  30. sealed trait TypeExtensibilityPropertyMetaInformation extends PropertyMetaInformation

    Permalink

    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.

    Extensibility w.r.t. the open-packages assumption

    A class is extensible if:

    • the class is not (effectively) final
    • one of its subclasses is extensible

    Extensibility w.r.t. the closed-packages assumption

    A class is extensible if:

    • the class is public and not (effectively) final
    • one of its subclasses is extensible

    Special cases

    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.

  31. sealed trait TypeImmutability extends OrderedProperty with TypeImmutabilityPropertyMetaInformation

    Permalink

    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.

  32. sealed trait TypeImmutabilityPropertyMetaInformation extends PropertyMetaInformation

    Permalink

Value Members

  1. object AnalysisModeSpecific extends InheritableByNewTypes with Product with Serializable

    Permalink
  2. object AtLeastConditionallyImmutableObject extends ObjectImmutability with Product with Serializable

    Permalink

    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.

  3. object AtLeastConditionallyImmutableType extends TypeImmutability with Product with Serializable

    Permalink
  4. object CallBySignature

    Permalink
  5. object ClassLocal extends ProjectAccessibility with Product with Serializable

    Permalink

    Entities with PackageLocal project accessibility can be accessed by every entity within the class where the entity is defined.

  6. object ClientCallable

    Permalink
  7. object ConditionallyImmutableObject extends ObjectImmutability with Product with Serializable

    Permalink

    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

  8. object ConditionallyImmutableType extends TypeImmutability with Product with Serializable

    Permalink
  9. object ConditionallyPure extends Purity with Product with Serializable

    Permalink

    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.

  10. object DeclaredFinalField extends FinalField with Product with Serializable

    Permalink
  11. object DoesNotLeakSelfReference extends SelfReferenceLeakage with Product with Serializable

    Permalink
  12. object EffectivelyFinalField extends FinalField with Product with Serializable

    Permalink
  13. object EntryPoint

    Permalink
  14. object ExtensibleType extends TypeExtensibility with Product with Serializable

    Permalink
  15. object FactoryMethod extends FactoryMethodPropertyMetaInformation

    Permalink

    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.

  16. object FieldMutability extends FieldMutabilityPropertyMetaInformation

    Permalink
  17. object Global extends ProjectAccessibility with Product with Serializable

    Permalink

    Entities with Global project accessibility can be accessed by every entity within the project.

  18. object ImmutableObject extends ObjectImmutability with Product with Serializable

    Permalink

    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.

  19. object ImmutableType extends TypeImmutability with Product with Serializable

    Permalink

    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

  20. object Impure extends Purity with Product with Serializable

    Permalink

    The respective method is impure.

  21. object InheritableByNewTypes

    Permalink
  22. object Instantiability extends InstantiabilityPropertyMetaInformation

    Permalink

    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.

  23. object Instantiable extends Instantiability with Product with Serializable

    Permalink

    Should be assigned to classes which can be instantiated or are instantiated.

  24. object IsClientCallable extends ClientCallable with Product with Serializable

    Permalink
  25. object IsEntryPoint extends EntryPoint with Product with Serializable

    Permalink

    The respective method is an entry point.

  26. object IsFactoryMethod extends FactoryMethod with Product with Serializable

    Permalink

    The respective method is a factory method.

  27. object IsInheritableByNewTypes extends InterfaceForNewSubtypes with Product with Serializable

    Permalink
  28. object LazyInitializedField extends FinalField with Product with Serializable

    Permalink
  29. object LeaksSelfReference extends SelfReferenceLeakage with Product with Serializable

    Permalink
  30. object MaybeExtensibleType extends TypeExtensibility with Product with Serializable

    Permalink
  31. object MaybeInstantiable extends Instantiability with Product with Serializable

    Permalink

    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.

  32. object MaybePure extends Purity with Product with Serializable

    Permalink

    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.

  33. object MethodComplexity extends MethodComplexityPropertyMetaInformation with Serializable

    Permalink
  34. object MutableObjectByAnalysis extends MutableObject with Product with Serializable

    Permalink
  35. object MutableObjectDueToUnknownSupertypes extends MutableObject with Product with Serializable

    Permalink
  36. object MutableObjectDueToUnresolvableDependency extends MutableObject with Product with Serializable

    Permalink
  37. object MutableType extends TypeImmutability with Product with Serializable

    Permalink
  38. object NoCBSTargets extends CallBySignature with Product with Serializable

    Permalink
  39. object NoEntryPoint extends EntryPoint with Product with Serializable

    Permalink

    The respective method is not an entry point.

  40. object NoExceptionsAreThrown extends Serializable

    Permalink
  41. object NonFinalFieldByAnalysis extends NonFinalField with Product with Serializable

    Permalink
  42. object NonFinalFieldByLackOfInformation extends NonFinalField with Product with Serializable

    Permalink
  43. object NotClientCallable extends ClientCallable with Product with Serializable

    Permalink
  44. object NotExtensibleType extends TypeExtensibility with Product with Serializable

    Permalink
  45. object NotFactoryMethod extends FactoryMethod with Product with Serializable

    Permalink

    The respective method is not a factory method.

  46. object NotInheritableByNewTypes extends InterfaceForNewSubtypes with Product with Serializable

    Permalink
  47. object NotInstantiable extends Instantiability with Product with Serializable

    Permalink

    NotInstantiable should be used for not instantiable classes.

    NotInstantiable should be used for not instantiable classes.

    Example:
    1. 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.

  48. object ObjectImmutability extends ObjectImmutabilityPropertyMetaInformation

    Permalink

    Common constants use by all ObjectImmutability properties associated with methods.

  49. object PackageLocal extends ProjectAccessibility with Product with Serializable

    Permalink

    Entities with PackageLocal project accessibility can be accessed by every entity within the package where the entity is defined.

  50. object ProjectAccessibility

    Permalink
  51. object Pure extends Purity with Product with Serializable

    Permalink

    The respective method is pure.

  52. object Purity extends PurityPropertyMetaInformation

    Permalink
  53. object SelfReferenceLeakage

    Permalink
  54. object ThrownExceptions

    Permalink
  55. object ThrownExceptionsAreUnknown extends Serializable

    Permalink
  56. object ThrownExceptionsFallbackAnalysis extends (PropertyStore, Entity) ⇒ ThrownExceptions

    Permalink

    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):

    Hence, the primary use case of this method is to identify those methods that are guaranteed to never throw exceptions.

  57. object TypeExtensibility extends TypeExtensibilityPropertyMetaInformation

    Permalink
  58. object TypeImmutability extends TypeImmutabilityPropertyMetaInformation

    Permalink

    Common constants use by all TypeImmutability properties associated with methods.

  59. object UnknownCBSTargets extends CallBySignature with Product with Serializable

    Permalink
  60. object UnknownObjectImmutability extends ObjectImmutability with Product with Serializable

    Permalink
  61. object UnknownTypeImmutability extends TypeImmutability with Product with Serializable

    Permalink

Ungrouped