edu.umd.cs.findbugs.detect
Class FindUnreleasedLock.LockResourceTracker

java.lang.Object
  extended by edu.umd.cs.findbugs.detect.FindUnreleasedLock.LockResourceTracker
All Implemented Interfaces:
ResourceTracker<Lock>
Enclosing class:
FindUnreleasedLock

static class FindUnreleasedLock.LockResourceTracker
extends java.lang.Object
implements ResourceTracker<Lock>


Field Summary
private  RepositoryLookupFailureCallback lookupFailureCallback
           
private  ValueNumberDataflow vnaDataflow
           
 
Constructor Summary
FindUnreleasedLock.LockResourceTracker(RepositoryLookupFailureCallback lookupFailureCallback, ValueNumberDataflow vnaDataflow)
           
 
Method Summary
 ResourceValueFrameModelingVisitor createVisitor(Lock resource, org.apache.bcel.generic.ConstantPoolGen cpg)
          Create a ResourceValueFrameModelingVisitor to model the effect of instructions on the state of the resource.
 boolean ignoreImplicitExceptions(Lock resource)
          Determine whether the analysis should ignore exception edges on which only implicit exceptions are propagated.
 boolean isParamInstance(Lock resource, int slot)
          Return if the given parameter slot contains the resource instance upon entry to the method.
 boolean isResourceClose(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, Lock resource, ResourceValueFrame frame)
          Determine if the given instruction is the site where a resource is closed.
 Lock isResourceCreation(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg)
          Determine if the given instruction is the site where a resource is created.
private static org.apache.bcel.generic.InvokeInstruction toInvokeInstruction(org.apache.bcel.generic.Instruction ins)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lookupFailureCallback

private RepositoryLookupFailureCallback lookupFailureCallback

vnaDataflow

private ValueNumberDataflow vnaDataflow
Constructor Detail

FindUnreleasedLock.LockResourceTracker

public FindUnreleasedLock.LockResourceTracker(RepositoryLookupFailureCallback lookupFailureCallback,
                                              ValueNumberDataflow vnaDataflow)
Method Detail

isResourceCreation

public Lock isResourceCreation(BasicBlock basicBlock,
                               org.apache.bcel.generic.InstructionHandle handle,
                               org.apache.bcel.generic.ConstantPoolGen cpg)
                        throws DataflowAnalysisException
Description copied from interface: ResourceTracker
Determine if the given instruction is the site where a resource is created.

Specified by:
isResourceCreation in interface ResourceTracker<Lock>
Parameters:
basicBlock - basic block containing the instruction
handle - the instruction
cpg - the ConstantPoolGen for the method
Returns:
an opaque Resource object if it is a creation site, or null if it is not a creation site
Throws:
DataflowAnalysisException

isResourceClose

public boolean isResourceClose(BasicBlock basicBlock,
                               org.apache.bcel.generic.InstructionHandle handle,
                               org.apache.bcel.generic.ConstantPoolGen cpg,
                               Lock resource,
                               ResourceValueFrame frame)
                        throws DataflowAnalysisException
Description copied from interface: ResourceTracker
Determine if the given instruction is the site where a resource is closed.

Specified by:
isResourceClose in interface ResourceTracker<Lock>
Parameters:
basicBlock - basic block containing the instruction
handle - the instruction
cpg - the ConstantPoolGen for the method
resource - the resource, as returned by isResourceCreation()
frame - the ResourceValueFrame representing the stack prior to executing the instruction
Returns:
true if the resource is closed here, false otherwise
Throws:
DataflowAnalysisException

createVisitor

public ResourceValueFrameModelingVisitor createVisitor(Lock resource,
                                                       org.apache.bcel.generic.ConstantPoolGen cpg)
Description copied from interface: ResourceTracker
Create a ResourceValueFrameModelingVisitor to model the effect of instructions on the state of the resource.

Specified by:
createVisitor in interface ResourceTracker<Lock>
Parameters:
resource - the resource we are tracking
cpg - the ConstantPoolGen of the method
Returns:
a ResourceValueFrameModelingVisitor

ignoreImplicitExceptions

public boolean ignoreImplicitExceptions(Lock resource)
Description copied from interface: ResourceTracker
Determine whether the analysis should ignore exception edges on which only implicit exceptions are propagated. This allows different resource types to be tracked with varying precision. For example, we might want to ignore implicit exceptions for stream objects, but treat them as significant for database resources.

Specified by:
ignoreImplicitExceptions in interface ResourceTracker<Lock>
Parameters:
resource - the resource being tracked
Returns:
true if implicit exceptions are significant, false if they should be ignore

isParamInstance

public boolean isParamInstance(Lock resource,
                               int slot)
Description copied from interface: ResourceTracker
Return if the given parameter slot contains the resource instance upon entry to the method. This is for resources passed as parameters.

Specified by:
isParamInstance in interface ResourceTracker<Lock>
Parameters:
resource - the resource
slot - the local variable slot
Returns:
true if the slot contains the resource instance, false otherwise

toInvokeInstruction

private static final org.apache.bcel.generic.InvokeInstruction toInvokeInstruction(org.apache.bcel.generic.Instruction ins)