Class LabeledMatcherTransition

  • All Implemented Interfaces:
    typestate.finiteautomata.ITransition

    public class LabeledMatcherTransition
    extends typestate.finiteautomata.MatcherTransition
    • Nested Class Summary

      • Nested classes/interfaces inherited from class typestate.finiteautomata.MatcherTransition

        typestate.finiteautomata.MatcherTransition.Parameter, typestate.finiteautomata.MatcherTransition.Type
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static typestate.finiteautomata.MatcherTransition getErrorTransition​(typestate.finiteautomata.State from, Collection<soot.SootMethod> matchingMethods, typestate.finiteautomata.MatcherTransition.Parameter param, typestate.finiteautomata.State to, typestate.finiteautomata.MatcherTransition.Type type)  
      Optional<CrySLMethod> getMatching​(soot.SootMethod method)
      Return the CrySLMethod's that match the given method.
      static LabeledMatcherTransition getTransition​(typestate.finiteautomata.State from, Collection<CrySLMethod> label, typestate.finiteautomata.MatcherTransition.Parameter param, typestate.finiteautomata.State to, typestate.finiteautomata.MatcherTransition.Type type)  
      static boolean isSubtype​(soot.SootClass child, soot.SootClass parent)
      Returns whether parent is a super type of child, i.e.
      boolean matches​(soot.SootMethod method)
      The matches method of MatcherTransition matches Methods taken from some InvokeExpr's.
      static boolean matches​(soot.SootMethod called, soot.SootMethod declared)
      Match the called method against a declared method and checker whether the called method could actually be the declared one.
      String toString()  
      • Methods inherited from class typestate.finiteautomata.MatcherTransition

        equals, getParam, getType, hashCode
      • Methods inherited from class typestate.finiteautomata.Transition

        from, identity, to
    • Method Detail

      • getTransition

        public static LabeledMatcherTransition getTransition​(typestate.finiteautomata.State from,
                                                             Collection<CrySLMethod> label,
                                                             typestate.finiteautomata.MatcherTransition.Parameter param,
                                                             typestate.finiteautomata.State to,
                                                             typestate.finiteautomata.MatcherTransition.Type type)
      • getErrorTransition

        public static typestate.finiteautomata.MatcherTransition getErrorTransition​(typestate.finiteautomata.State from,
                                                                                    Collection<soot.SootMethod> matchingMethods,
                                                                                    typestate.finiteautomata.MatcherTransition.Parameter param,
                                                                                    typestate.finiteautomata.State to,
                                                                                    typestate.finiteautomata.MatcherTransition.Type type)
      • matches

        public static boolean matches​(soot.SootMethod called,
                                      soot.SootMethod declared)
        Match the called method against a declared method and checker whether the called method could actually be the declared one.
        Parameters:
        called - the called method
        declared - the declared method
        Returns:
        true, if called and declared method match
      • isSubtype

        public static boolean isSubtype​(soot.SootClass child,
                                        soot.SootClass parent)
        Returns whether parent is a super type of child, i.e. if they are the same, child implements or extends parent transitively.
        Parameters:
        child - the child to check
        parent - the parent to check against
        Returns:
        true, if parent is a super type of child
      • matches

        public boolean matches​(soot.SootMethod method)
        The matches method of MatcherTransition matches Methods taken from some InvokeExpr's. The method getDeclaringClass() will return the object's class they are called on not the actual declaring class. Thus, if the class under spec does not declare the method, CrySLMethodToSootMethod won't find a matching method with the same declaring class and the label will not contain the method. We therefore check if there is a matching Method if the MatcherTransition returns false. The state machine is per Class, so every method will have the same declaring class and it is correct to return true if it matches the method of *some* super-type.
        Overrides:
        matches in class typestate.finiteautomata.MatcherTransition
        See Also:
        MatcherTransition.matches(soot.SootMethod)
      • getMatching

        public Optional<CrySLMethod> getMatching​(soot.SootMethod method)
        Return the CrySLMethod's that match the given method. As the method is taken from a statement, we need to apply the mathcing logic defined here, to get the CrySLMethods that were resolved to the matching SootMethods.
        Parameters:
        method - the given method
        Returns:
        The CrySLMethod's matching the given soot method.
      • toString

        public String toString()
        Overrides:
        toString in class typestate.finiteautomata.MatcherTransition