edu.umd.cs.findbugs.ba.type

Class ExceptionSet

public class ExceptionSet extends Object implements Serializable

Class for keeping track of exceptions that can be thrown by an instruction. We distinguish explicit and implicit exceptions. Explicit exceptions are explicitly declared, thrown, or caught. Implicit exceptions are runtime faults (NPE, array out of bounds) not explicitly handled by the user code.

Author: David Hovemeyer

See Also: TypeAnalysis

Nested Class Summary
classExceptionSet.ThrownExceptionIterator
Object to iterate over the exception types in the set.
Method Summary
voidadd(ObjectType type, boolean explicit)
Add an exception.
voidaddAll(ExceptionSet other)
Add all exceptions in the given set.
voidaddExplicit(ObjectType type)
Add an explicit exception.
voidaddImplicit(ObjectType type)
Add an implicit exception.
voidclear()
Remove all exceptions from the set.
booleancontainsCheckedExceptions()
Return whether or not the set contains any checked exceptions.
booleancontainsExplicitExceptions()
Return whether or not the set contains any explicit exceptions.
ExceptionSetduplicate()
Return an exact copy of this object.
TypegetCommonSupertype()
Get the least (lowest in the lattice) common supertype of the exceptions in the set.
booleanisEmpty()
Return whether or not the set is empty.
booleanisSingleton(String exceptionName)
Checks to see if the exception set is a singleton set containing just the named exception
ExceptionSet.ThrownExceptionIteratoriterator()
Return an iterator over thrown exceptions.
voidsawUniversal()
Return whether or not a universal exception handler was reached by the set.
booleansawUniversalHandler()
Mark the set as having reached a universal exception handler.
intsize()

Method Detail

add

public void add(ObjectType type, boolean explicit)
Add an exception.

Parameters: type the exception type explicit true if the exception is explicitly declared or thrown, false if implicit

addAll

public void addAll(ExceptionSet other)
Add all exceptions in the given set.

Parameters: other the set

addExplicit

public void addExplicit(ObjectType type)
Add an explicit exception.

Parameters: type type of the exception

addImplicit

public void addImplicit(ObjectType type)
Add an implicit exception.

Parameters: type type of the exception

clear

public void clear()
Remove all exceptions from the set.

containsCheckedExceptions

public boolean containsCheckedExceptions()
Return whether or not the set contains any checked exceptions.

containsExplicitExceptions

public boolean containsExplicitExceptions()
Return whether or not the set contains any explicit exceptions.

duplicate

public ExceptionSet duplicate()
Return an exact copy of this object.

getCommonSupertype

public Type getCommonSupertype()
Get the least (lowest in the lattice) common supertype of the exceptions in the set. Returns the special TOP type if the set is empty.

isEmpty

public boolean isEmpty()
Return whether or not the set is empty.

isSingleton

public boolean isSingleton(String exceptionName)
Checks to see if the exception set is a singleton set containing just the named exception

Parameters: exceptionName (in dotted format)

Returns: true if it is

iterator

public ExceptionSet.ThrownExceptionIterator iterator()
Return an iterator over thrown exceptions.

sawUniversal

public void sawUniversal()
Return whether or not a universal exception handler was reached by the set.

sawUniversalHandler

public boolean sawUniversalHandler()
Mark the set as having reached a universal exception handler.

size

public int size()
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.