Class ExceptionSet
java.lang.Object
edu.umd.cs.findbugs.ba.type.ExceptionSet
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassObject to iterate over the exception types in the set. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.bcel.generic.Typeprivate final BitSetprivate final BitSetprivate final ExceptionSetFactoryprivate intprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(org.apache.bcel.generic.ObjectType type, boolean explicit) Add an exception.voidaddAll(ExceptionSet other) Add all exceptions in the given set.voidaddExplicit(org.apache.bcel.generic.ObjectType type) Add an explicit exception.voidaddImplicit(org.apache.bcel.generic.ObjectType type) Add an implicit exception.voidclear()Remove all exceptions from the set.booleanReturn whether or not the set contains any checked exceptions.booleanReturn whether or not the set contains any explicit exceptions.private intReturn an exact copy of this object.booleanorg.apache.bcel.generic.TypeGet the least (lowest in the lattice) common supertype of the exceptions in the set.inthashCode()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 exceptioniterator()Return an iterator over thrown exceptions.voidReturn whether or not a universal exception handler was reached by the set.booleanMark the set as having reached a universal exception handler.intsize()toString()
-
Field Details
-
factory
-
exceptionSet
-
explicitSet
-
size
private int size -
universalHandler
private boolean universalHandler -
commonSupertype
private org.apache.bcel.generic.Type commonSupertype
-
-
Constructor Details
-
ExceptionSet
ExceptionSet(ExceptionSetFactory factory) Constructor. Creates an empty set.
-
-
Method Details
-
duplicate
Return an exact copy of this object. -
hashCode
-
equals
-
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.- Throws:
ClassNotFoundException
-
iterator
Return an iterator over thrown exceptions. -
isEmpty
public boolean isEmpty()Return whether or not the set is empty. -
isSingleton
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
-
addExplicit
public void addExplicit(org.apache.bcel.generic.ObjectType type) Add an explicit exception.- Parameters:
type- type of the exception
-
addImplicit
public void addImplicit(org.apache.bcel.generic.ObjectType type) Add an implicit exception.- Parameters:
type- type of the exception
-
add
public void add(org.apache.bcel.generic.ObjectType type, boolean explicit) Add an exception.- Parameters:
type- the exception typeexplicit- true if the exception is explicitly declared or thrown, false if implicit
-
addAll
Add all exceptions in the given set.- Parameters:
other- the set
-
countBits
-
clear
public void clear()Remove all exceptions from the set. -
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. -
containsCheckedExceptions
Return whether or not the set contains any checked exceptions.- Throws:
ClassNotFoundException
-
containsExplicitExceptions
public boolean containsExplicitExceptions()Return whether or not the set contains any explicit exceptions. -
toString
-
size
public int size()
-