Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package opalj

    OPAL is a Scala-based framework for the static analysis, manipulation and creation of Java bytecode.

    OPAL is a Scala-based framework for the static analysis, manipulation and creation of Java bytecode. OPAL is designed with performance, scalability and adaptability in mind.

    Its main components are:

    • a library (Common) which provides generally useful data-structures and algorithms for static analyses.
    • a framework for implementing lattice based static analyses (Static Analysis Infrastructure)
    • a framework for parsing Java bytecode (Bytecode Infrastructure) that can be used to create arbitrary representations.
    • a library to create a one-to-one in-memory representation of Java bytecode (Bytecode Disassembler).
    • a library to create a representation of Java bytecode that facilitates writing simple static analyses (Bytecode Representation - org.opalj.br).
    • a scalable, easily customizable framework for the abstract interpretation of Java bytecode (Abstract Interpretation Framework - org.opalj.ai).
    • a library to extract dependencies between code elements and to facilitate checking architecture definitions.
    • a library for the lightweight manipulation and creation of Java bytecode (Bytecode Assembler).

    General Design Decisions

    Thread Safety

    Unless explicitly noted, OPAL is thread safe. I.e., the classes defined by OPAL can be considered to be thread safe unless otherwise stated. (For example, it is possible to read and process class files concurrently without explicit synchronization on the client side.)

    No null Values

    Unless explicitly noted, OPAL does not null values I.e., fields that are accessible will never contain null values and methods will never return null. If a method accepts null as a value for a parameter or returns a null value it is always explicitly documented. In general, the behavior of methods that are passed null values is undefined unless explicitly documented.

    No Typecasts for Collections

    For efficiency reasons, OPAL sometimes uses mutable data-structures internally. After construction time, these data-structures are generally represented using their generic interfaces (e.g., scala.collection.{Set,Map}). However, a downcast (e.g., to add/remove elements) is always forbidden as it would effectively prevent thread-safety.

    Assertions

    OPAL makes heavy use of Scala's Assertion Facility to facilitate writing correct code. Hence, for production builds (after thorough testing(!)) it is highly recommend to build OPAL again using -Xdisable-assertions.

    Definition Classes
    org
  • package av
    Definition Classes
    opalj
  • package checking

    Helper classes and functionality related to specifying architectural concerns.

    Helper classes and functionality related to specifying architectural concerns.

    Definition Classes
    av
  • AccessFlags
  • AllClasses
  • AnnotatedWith
  • AnnotationPredicate
  • AnnotationsPredicate
  • AnyAnnotation
  • AnyAnnotations
  • AnyMethod
  • ArchitectureChecker
  • Attributes
  • BinaryString
  • ClassLevelMatcher
  • ClassMatcher
  • DefaultClassMatcher
  • DependencyChecker
  • DependencyViolation
  • Equals
  • FieldMatcher
  • HasAnnotation
  • HasAtLeastOneAnnotation
  • HasAtLeastTheAnnotations
  • HasTheAnnotations
  • MethodMatcher
  • MethodWithName
  • MethodWithSignature
  • NamePredicate
  • NoAnnotations
  • NoSourceElementsMatcher
  • PackageMatcher
  • PropertyChecker
  • PropertyViolation
  • RegexNamePredicate
  • SourceElementPredicate
  • SourceElementsMatcher
  • Specification
  • SpecificationError
  • SpecificationViolation
  • StartsWith
  • package viz
    Definition Classes
    av
p

org.opalj.av

checking

package checking

Helper classes and functionality related to specifying architectural concerns.

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. checking
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. case class AccessFlags(accessFlags: AccessFlagsMatcher) extends SourceElementPredicate[ConcreteSourceElement] with Product with Serializable
  2. case class AnnotatedWith(annotationType: FieldType, elementValuePairs: Seq[ElementValuePair]) extends AnnotationPredicate with Product with Serializable

    Tests if an annotation of a class, field, method or method parameter is as specified.

    Tests if an annotation of a class, field, method or method parameter is as specified. The test takes the element values into consideration; if you don't want to take them into consideration use a HasAnnotation predicate.

    scala> import org.opalj.br._
    scala> import org.opalj.av.checking._
    scala> val foo = ObjectType("java/lang/Foo")
    
    scala> val am = AnnotationPredicate("java.lang.Foo",Map("clazz" -> StringValue("")))
    am: org.opalj.av.checking.AnnotationPredicate = @java.lang.Foo(clazz="")
    
    scala> am(Annotation(foo,IndexedSeq(ElementValuePair("clazz",StringValue("")))))
    res: Boolean = true
    
    scala> am(Annotation(foo,IndexedSeq(ElementValuePair("clazz",StringValue("-+-")))))
    res: Boolean = false
    
    scala> val am = DefaultAnnotationPredicate("java.lang.Foo",IndexedSeq.empty)
    am: org.opalj.av.checking.DefaultAnnotationPredicate = @java.lang.Foo()
    
    scala> am(Annotation(ObjectType("java/lang/Foo"),IndexedSeq(ElementValuePair("clazz",StringValue(" ")))))
    res: Boolean = false
  3. trait AnnotationPredicate extends SourceElementPredicate[ConcreteSourceElement]

    Matches an annotation of a class, field, method or method parameter.

  4. trait AnnotationsPredicate extends (Iterable[Annotation]) => Boolean

  5. sealed trait ArchitectureChecker extends AnyRef

    An architecture checker validates if the implemented architecture complies with the expected/specified one.

  6. case class Attributes(attributes: br.Attributes) extends SourceElementPredicate[ConcreteSourceElement] with Product with Serializable

  7. final class BinaryString extends AnyRef

    Helper class to mark those places where a string using binary notation (i.e., where packages are separated using "/" instead of ".") is expected.

    Helper class to mark those places where a string using binary notation (i.e., where packages are separated using "/" instead of ".") is expected.

    A related implicit conversion is defined in the package object.

  8. trait ClassLevelMatcher extends SourceElementsMatcher

    A class level matcher matches classes and all methods and fields defined by the respective classes.

  9. trait ClassMatcher extends ClassLevelMatcher

    A class matcher matches classes defined by the respective classes.

  10. case class DefaultClassMatcher(accessFlagsMatcher: AccessFlagsMatcher = AccessFlagsMatcher.ANY, namePredicate: NamePredicate = RegexNamePredicate(""".*""".r), annotationsPredicate: AnnotationsPredicate = AnyAnnotations, matchSubclasses: Boolean = false, matchImplementingclasses: Boolean = false, matchMethods: Boolean = true, matchFields: Boolean = true) extends ClassMatcher with Product with Serializable

    Default class matcher matches classes defined by the respective classes.

  11. trait DependencyChecker extends ArchitectureChecker

    A dependency checker validates if the dependencies between the elements of two ensembles comply with the expected/specified dependencies.

  12. case class DependencyViolation(project: SomeProject, dependencyChecker: DependencyChecker, source: VirtualSourceElement, target: VirtualSourceElement, dependencyType: DependencyType, description: String) extends SpecificationViolation with Product with Serializable

    Used to report deviations between the specified/expected and the implemented dependencies.

  13. case class Equals(name: BinaryString) extends NamePredicate with Product with Serializable

  14. case class FieldMatcher(declaringClass: ClassLevelMatcher, annotations: AnnotationsPredicate, theType: Option[FieldType], theName: Option[NamePredicate]) extends SourceElementsMatcher with Product with Serializable

    Matches fields based on their name, type, annotations and declaring class.

  15. case class HasAnnotation(annotationType: FieldType) extends AnnotationPredicate with Product with Serializable

    Matches an annotation of a class, field, method or method parameter that has the specified type.

    Matches an annotation of a class, field, method or method parameter that has the specified type. The annotation is matched independent of the annotation's values.

    Example

    scala> import org.opalj.br._
    scala> val foo = ObjectType("java/lang/Foo")
    scala> val aw = org.opalj.av.checking.AnnotatedWith(foo)
    aw: org.opalj.av.checking.AnnotatedWith = @java.lang.Foo
    scala> aw(Annotation(foo,IndexedSeq(ElementValuePair("clazz",StringValue(" ")))))
    res: Boolean = true
  16. case class HasAtLeastOneAnnotation(annotationPredicates: Set[_ <: AnnotationPredicate]) extends AnnotationsPredicate with Product with Serializable

  17. case class HasAtLeastTheAnnotations(annotationPredicates: Set[_ <: AnnotationPredicate]) extends AnnotationsPredicate with Product with Serializable

  18. case class HasTheAnnotations(annotationPredicates: Set[_ <: AnnotationPredicate]) extends AnnotationsPredicate with Product with Serializable

  19. case class MethodMatcher(classLevelMatcher: ClassLevelMatcher = AllClasses, annotationsPredicate: AnnotationsPredicate = AnyAnnotations, methodPredicate: SourceElementPredicate[Method] = AnyMethod) extends SourceElementsMatcher with Product with Serializable

    Matches methods based on their attributes, annotations and class.

  20. case class MethodWithName(name: String) extends SourceElementPredicate[Method] with Product with Serializable

  21. case class MethodWithSignature(name: String, descriptor: MethodDescriptor) extends SourceElementPredicate[Method] with Product with Serializable

  22. trait NamePredicate extends (String) => Boolean

    Matches a (binary) name of a file, method or class.

  23. case class PackageMatcher(namePredicate: NamePredicate, classMatcher: ClassMatcher) extends ClassLevelMatcher with Product with Serializable

    Matches all classes in the specified package.

  24. trait PropertyChecker extends ArchitectureChecker

    A property checker validates if the elements of an ensemble have the expected/specified properties.

  25. case class PropertyViolation(project: SomeProject, propertyChecker: PropertyChecker, source: VirtualSourceElement, propertyType: String, description: String) extends SpecificationViolation with Product with Serializable

    Used to report source elements that have properties that deviate from the expected ones.

  26. case class RegexNamePredicate(matcher: Regex) extends NamePredicate with Product with Serializable

    Matches name of class, fields and methods based on their name.

    Matches name of class, fields and methods based on their name.

    The name is matched against the binary notation.

  27. trait SourceElementPredicate[-S <: ConcreteSourceElement] extends (S) => Boolean

    A predicate related to a specific source element.

  28. trait SourceElementsMatcher extends (SomeProject) => Set[VirtualSourceElement]

    A source element matcher determines a set of source elements that matches a given query.

  29. class Specification extends AnyRef

    A specification of a project's architectural constraints.

    A specification of a project's architectural constraints.

    Usage

    First define the ensembles, then the rules and at last specify the class files that should be analyzed. The rules will then automatically be evaluated.

    The intended way to create a specification is to create a new anonymous Specification class that contains the specification of the architecture. Afterwards the specification object can be used to get the list of architectural violations.

    new Specification(project) {
               ensemble('Number) { "mathematics.Number*" }
               ensemble('Rational) { "mathematics.Rational*" }
               ensemble('Mathematics) { "mathematics.Mathematics*" }
               ensemble('Example) { "mathematics.Example*" }
    
               'Example is_only_allowed_to (USE, 'Mathematics)
          }
    Note

    One ensemble is predefined: Specification.empty it represents an ensemble that contains no source elements and which can, e.g., be used to specify that no "real" ensemble is allowed to depend on a specific ensemble.

  30. case class SpecificationError(description: String) extends Exception with Product with Serializable

    Used to report errors in the specification itself.

  31. sealed trait SpecificationViolation extends AnyRef

    Used to report deviations between the specified and the implemented architecture.

  32. case class StartsWith(name: BinaryString) extends NamePredicate with Product with Serializable

Value Members

  1. implicit def StringToBinaryString(string: String): BinaryString
  2. case object AllClasses extends ClassMatcher with Product with Serializable

    Matches all project and library classes including inner elements like methods and fields defined by the respective classes.

  3. object AnnotatedWith extends Serializable

    Defines several additional factory methods to facilitate the creation of AnnotationPredicates.

  4. case object AnyAnnotation extends AnnotationPredicate with Product with Serializable

    An annotation matcher that always returns true; it matches any annotation.

  5. case object AnyAnnotations extends AnnotationsPredicate with Product with Serializable

  6. case object AnyMethod extends SourceElementPredicate[Method] with Product with Serializable

  7. object BinaryString
  8. object ClassMatcher

    Defines several additional factory methods to facilitate the creation of ClassMatchers.

  9. object FieldMatcher extends Serializable

    Defines several additional factory methods to facilitate the creation of FieldMatchers.

  10. object HasAnnotation extends Serializable

    Factory methods to create AnnotatedWith predicates.

  11. object HasAtLeastTheAnnotations extends Serializable
  12. object HasTheAnnotations extends Serializable
  13. object MethodMatcher extends Serializable

    Defines several additional factory methods to facilitate the creation of MethodMatchers.

  14. case object NoAnnotations extends AnnotationsPredicate with Product with Serializable

  15. case object NoSourceElementsMatcher extends SourceElementsMatcher with Product with Serializable

    A source element matcher that matches no elements.

  16. object PackageMatcher extends Serializable

    Defines several additional factory methods to facilitate the creation of PackageMatchers.

  17. object Specification

Inherited from AnyRef

Inherited from Any

Ungrouped