Package edu.umd.cs.findbugs.detect
Class InstanceFieldLoadStreamFactory
- java.lang.Object
-
- edu.umd.cs.findbugs.detect.InstanceFieldLoadStreamFactory
-
- All Implemented Interfaces:
StreamFactory
public class InstanceFieldLoadStreamFactory extends java.lang.Object implements StreamFactory
StreamFactory for stream objects loaded from instance fields.- Author:
- David Hovemeyer
-
-
Constructor Summary
Constructors Constructor Description InstanceFieldLoadStreamFactory(java.lang.String streamBaseClass)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream
createStream(Location location, org.apache.bcel.generic.ObjectType type, org.apache.bcel.generic.ConstantPoolGen cpg, RepositoryLookupFailureCallback lookupFailureCallback)
Determine if a Stream is created at given location.InstanceFieldLoadStreamFactory
setBugPatternType(java.lang.String bugPatternType)
Set the bug pattern type reported for unclosed streams loaded from this field.
-
-
-
Constructor Detail
-
InstanceFieldLoadStreamFactory
public InstanceFieldLoadStreamFactory(java.lang.String streamBaseClass)
Constructor. By default, Streams created by this factory will not be marked as interesting. The setBugPatternType() method should be called to make the factory produce interesting streams.- Parameters:
streamBaseClass
- the base class of the streams produced by the factory
-
-
Method Detail
-
setBugPatternType
public InstanceFieldLoadStreamFactory setBugPatternType(java.lang.String bugPatternType)
Set the bug pattern type reported for unclosed streams loaded from this field. This makes the created streams "interesting".- Parameters:
bugPatternType
- the bug pattern type
-
createStream
public Stream createStream(Location location, org.apache.bcel.generic.ObjectType type, org.apache.bcel.generic.ConstantPoolGen cpg, RepositoryLookupFailureCallback lookupFailureCallback)
Description copied from interface:StreamFactory
Determine if a Stream is created at given location.- Specified by:
createStream
in interfaceStreamFactory
- Parameters:
location
- the Locationtype
- the ObjectType associated with the instruction at the location; the StreamResourceTracker prescreens for TypedInstructions that are associated with ObjectTypes, since they are the only instructions that could conceivably create a stream objectcpg
- the ConstantPoolGen for the methodlookupFailureCallback
- used to report missing classes in the class hierarchy- Returns:
- a Stream created at the Location, or null if no stream is created there
-
-