edu.umd.cs.findbugs.detect

Class Stream

public class Stream extends ResourceCreationPoint implements Comparable<Stream>

A Stream object marks the location in the code where a stream is created. It also is responsible for determining some aspects of how the stream state is tracked by the ResourceValueAnalysis, such as when the stream is opened or closed, and whether implicit exception edges are significant.

TODO: change streamClass and streamBase to ObjectType

TODO: isStreamOpen() and isStreamClose() should probably be abstract, so we can customize how they work for different kinds of streams

Constructor Summary
Stream(Location location, String streamClass, String streamBase)
Constructor.
Method Summary
intcompareTo(Stream other)
StringgetBugType()
intgetInstanceParam()
LocationgetOpenLocation()
StringgetStreamBase()
booleanignoreImplicitExceptions()
booleanisClosed()
Return whether or not the Stream is closed on all paths out of the method.
booleanisOpenOnCreation()
booleanisStreamClose(BasicBlock basicBlock, InstructionHandle handle, ConstantPoolGen cpg, ResourceValueFrame frame, RepositoryLookupFailureCallback lookupFailureCallback)
booleanisStreamOpen(BasicBlock basicBlock, InstructionHandle handle, ConstantPoolGen cpg, ResourceValueFrame frame)
booleanisUninteresting()
voidsetClosed()
Set this Stream has having been closed on all paths out of the method.
StreamsetIgnoreImplicitExceptions(boolean enable)
Mark whether or not implicit exception edges should be ignored by ResourceValueAnalysis when determining whether or not stream is closed on all paths out of method.
voidsetInstanceParam(int instanceParam)
Set the number of the parameter which passes the stream instance.
StreamsetInteresting(String bugType)
Mark this Stream as interesting.
StreamsetIsOpenOnCreation(boolean enable)
Mark whether or not Stream is open as soon as it is created, or whether a later method or constructor must explicitly open it.
voidsetOpenLocation(Location openLocation)

Constructor Detail

Stream

public Stream(Location location, String streamClass, String streamBase)
Constructor. By default, Stream objects are marked as uninteresting. setInteresting("BUG_TYPE") must be called explicitly to mark the Stream as interesting.

Parameters: location where the stream is created streamClass type of Stream streamBase highest class in the class hierarchy through which stream's close() method could be called

Method Detail

compareTo

public int compareTo(Stream other)

getBugType

public String getBugType()

getInstanceParam

public int getInstanceParam()

getOpenLocation

public Location getOpenLocation()

getStreamBase

public String getStreamBase()

ignoreImplicitExceptions

public boolean ignoreImplicitExceptions()

isClosed

public boolean isClosed()
Return whether or not the Stream is closed on all paths out of the method.

isOpenOnCreation

public boolean isOpenOnCreation()

isStreamClose

public boolean isStreamClose(BasicBlock basicBlock, InstructionHandle handle, ConstantPoolGen cpg, ResourceValueFrame frame, RepositoryLookupFailureCallback lookupFailureCallback)

isStreamOpen

public boolean isStreamOpen(BasicBlock basicBlock, InstructionHandle handle, ConstantPoolGen cpg, ResourceValueFrame frame)

isUninteresting

public boolean isUninteresting()

setClosed

public void setClosed()
Set this Stream has having been closed on all paths out of the method.

setIgnoreImplicitExceptions

public Stream setIgnoreImplicitExceptions(boolean enable)
Mark whether or not implicit exception edges should be ignored by ResourceValueAnalysis when determining whether or not stream is closed on all paths out of method.

setInstanceParam

public void setInstanceParam(int instanceParam)
Set the number of the parameter which passes the stream instance.

Parameters: instanceParam number of the parameter passing the stream instance

setInteresting

public Stream setInteresting(String bugType)
Mark this Stream as interesting.

Parameters: bugType the bug type that should be reported if the stream is not closed on all paths out of the method

setIsOpenOnCreation

public Stream setIsOpenOnCreation(boolean enable)
Mark whether or not Stream is open as soon as it is created, or whether a later method or constructor must explicitly open it.

setOpenLocation

public void setOpenLocation(Location openLocation)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.