Package spoon

Class ContractVerifier

java.lang.Object
spoon.ContractVerifier

public class ContractVerifier extends Object
Verifies all contracts that should hold on any AST. Usage: `new ContractVerifier(pack).verifyAll();`
  • Constructor Details

    • ContractVerifier

      public ContractVerifier(CtPackage rootPackage)
    • ContractVerifier

      public ContractVerifier()
      use at your own risk, not part of the public API
  • Method Details

    • verify

      public void verify()
      verify all possible contracts in this class
    • checkModifiers

      public void checkModifiers()
      verifies that the explicit modifier should be present in the original source code
    • checkParentContract

      public void checkParentContract()
      checks that there is always one parent, corresponding to the scanning order
    • checkBoundAndUnboundTypeReference

      public void checkBoundAndUnboundTypeReference()
    • checkShadow

      public void checkShadow()
      check that we have all shadow elements, and that they are correctly isShadow
    • checkContractCtScanner

      public void checkContractCtScanner()
      verifies the core scanning contracts (enter implies exit, etc)
    • checkAssignmentContracts

      public void checkAssignmentContracts()
      checks that all assignments are aither a CtFieldWrite, a CtVariableWrite or a CtArrayWrite
    • checkParentConsistency

      public void checkParentConsistency()
      checks that the scanner behavior and the parents correspond
    • checkParentConsistency

      public void checkParentConsistency(CtElement element)
      public modifier for testing purpose only, not in the public API
    • checkModelIsTree

      public void checkModelIsTree()
      contract: each element is used only once in the model
    • checkRoleInParent

      public void checkRoleInParent()
    • checkElementToPathToElementEquivalence

      public void checkElementToPathToElementEquivalence()
      checks that for all elements, the path can be obtained, parsed, and give the same element when evaluated
    • checkElementIsContainedInAttributeOfItsParent

      public void checkElementIsContainedInAttributeOfItsParent()
      contract: element is contained in attribute of element's parent
    • checkGenericContracts

      public void checkGenericContracts()
    • checkJavaIdentifiers

      public void checkJavaIdentifiers()
      checks that the identifiers are valid