public class StreamResourceTracker extends java.lang.Object implements ResourceTracker<Stream>
Constructor and Description |
---|
StreamResourceTracker(StreamFactory[] streamFactoryList,
RepositoryLookupFailureCallback lookupFailureCallback)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addStreamEscape(Stream source,
Location target)
Indicate that a stream escapes at the given target Location.
|
void |
addStreamOpenLocation(Location streamOpenLocation,
Stream stream)
Indicate that a stream is constructed at this Location.
|
ResourceValueFrameModelingVisitor |
createVisitor(Stream resource,
org.apache.bcel.generic.ConstantPoolGen cpg)
Create a ResourceValueFrameModelingVisitor to model the effect of
instructions on the state of the resource.
|
StreamEquivalenceClass |
getStreamEquivalenceClass(Stream stream)
Get the equivalence class for given stream.
|
boolean |
ignoreExceptionEdge(Edge edge,
Stream resource,
org.apache.bcel.generic.ConstantPoolGen cpg)
Determine whether the analysis should ignore given exception edge.
|
boolean |
ignoreImplicitExceptions(Stream resource)
Determine whether the analysis should ignore exception edges on which
only implicit exceptions are propagated.
|
boolean |
isParamInstance(Stream 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,
Stream resource,
ResourceValueFrame frame)
Determine if the given instruction is the site where a resource is
closed.
|
Stream |
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.
|
boolean |
isResourceOpen(BasicBlock basicBlock,
org.apache.bcel.generic.InstructionHandle handle,
org.apache.bcel.generic.ConstantPoolGen cpg,
Stream resource,
ResourceValueFrame frame) |
boolean |
isUninterestingStreamEscape(Stream stream)
Determine if an uninteresting stream escapes at given location.
|
void |
markTransitiveUninterestingStreamEscapes()
Transitively mark all streams into which uninteresting streams (such as
System.out) escape.
|
boolean |
mightCloseResource(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
closed.
|
void |
setResourceCollection(ResourceCollection<Stream> resourceCollection)
Set the precomputed ResourceCollection for the method.
|
public StreamResourceTracker(StreamFactory[] streamFactoryList, RepositoryLookupFailureCallback lookupFailureCallback)
streamFactoryList
- array of StreamFactory objects which determine where streams
are createdlookupFailureCallback
- used when class hierarchy lookups failpublic void setResourceCollection(ResourceCollection<Stream> resourceCollection)
public void addStreamEscape(Stream source, Location target)
source
- the Stream that is escapingtarget
- the target Location (where the stream escapes)public void markTransitiveUninterestingStreamEscapes()
public boolean isUninterestingStreamEscape(Stream stream)
stream
- the streampublic void addStreamOpenLocation(Location streamOpenLocation, Stream stream)
streamOpenLocation
- the Locationstream
- the Stream opened at this Locationpublic StreamEquivalenceClass getStreamEquivalenceClass(Stream stream)
stream
- the streampublic Stream isResourceCreation(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg)
ResourceTracker
isResourceCreation
in interface ResourceTracker<Stream>
basicBlock
- basic block containing the instructionhandle
- the instructioncpg
- the ConstantPoolGen for the methodpublic boolean isResourceOpen(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, Stream resource, ResourceValueFrame frame)
public boolean isResourceClose(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, Stream resource, ResourceValueFrame frame)
ResourceTracker
isResourceClose
in interface ResourceTracker<Stream>
basicBlock
- basic block containing the instructionhandle
- the instructioncpg
- the ConstantPoolGen for the methodresource
- the resource, as returned by isResourceCreation()frame
- the ResourceValueFrame representing the stack prior to
executing the instructionpublic boolean mightCloseResource(BasicBlock basicBlock, org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg) throws DataflowAnalysisException
ResourceTracker
mightCloseResource
in interface ResourceTracker<Stream>
basicBlock
- basic block containing the instructionhandle
- the instructioncpg
- the ConstantPoolGen for the methodDataflowAnalysisException
public ResourceValueFrameModelingVisitor createVisitor(Stream resource, org.apache.bcel.generic.ConstantPoolGen cpg)
ResourceTracker
createVisitor
in interface ResourceTracker<Stream>
resource
- the resource we are trackingcpg
- the ConstantPoolGen of the methodpublic boolean ignoreImplicitExceptions(Stream resource)
ResourceTracker
ignoreImplicitExceptions
in interface ResourceTracker<Stream>
resource
- the resource being trackedpublic boolean ignoreExceptionEdge(Edge edge, Stream resource, org.apache.bcel.generic.ConstantPoolGen cpg)
ResourceTracker
ignoreExceptionEdge
in interface ResourceTracker<Stream>
edge
- the exception edgeresource
- the resourcecpg
- the ConstantPoolGenpublic boolean isParamInstance(Stream resource, int slot)
ResourceTracker
isParamInstance
in interface ResourceTracker<Stream>
resource
- the resourceslot
- the local variable slotFindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.