Class FindUnsatisfiedObligation.MethodChecker

  • Enclosing class:
    FindUnsatisfiedObligation

    private class FindUnsatisfiedObligation.MethodChecker
    extends java.lang.Object
    A helper class to check a single method for unsatisfied obligations. Avoids having to pass millions of parameters to each method (type dataflow, null value dataflow, etc.).
    • Method Detail

      • checkStateForLeakedObligations

        private void checkStateForLeakedObligations​(State state,
                                                    java.util.Map<Obligation,​State> leakedObligationMap)
                                             throws java.lang.IllegalStateException
        Throws:
        java.lang.IllegalStateException
      • annotateWarningWithSourceLineInformation

        private void annotateWarningWithSourceLineInformation​(State state,
                                                              Obligation obligation,
                                                              BugInstance bugInstance)
      • getAdjustedLeakCount

        private int getAdjustedLeakCount​(State state,
                                         int obligationId)
        Get the adjusted leak count for the given State and obligation type. Use heuristics to account for:
        • null checks (count the number of times the supposedly leaked obligation is compared to null, and subtract those from the leak count)
        • field assignments (count number of times obligation type is assigned to a field, and subtract those from the leak count)
        • return statements (if an instance of the obligation type is returned from the method, subtract one from leak count)
        Returns:
        the adjusted leak count (positive if leaked obligation, negative if attempt to release an un-acquired obligation)
      • isPossibleInstanceOfObligationType

        private boolean isPossibleInstanceOfObligationType​(Subtypes2 subtypes2,
                                                           org.apache.bcel.generic.ObjectType type,
                                                           org.apache.bcel.generic.ObjectType obligationType)
                                                    throws java.lang.ClassNotFoundException
        Throws:
        java.lang.ClassNotFoundException