|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpolyglot.visit.NodeVisitor
polyglot.visit.HaltingVisitor
polyglot.visit.ErrorHandlingVisitor
polyglot.visit.ExceptionChecker
public class ExceptionChecker
Visitor which checks if exceptions are caught or declared properly.
Nested Class Summary | |
---|---|
static class |
ExceptionChecker.CodeTypeReporter
|
static class |
ExceptionChecker.UncaughtReporter
|
Field Summary | |
---|---|
protected java.util.Set |
catchable
Set of exceptions that can be caught. |
protected boolean |
catchAllThrowable
Should the propogation of eceptions upwards go past this point? |
protected ExceptionChecker |
outer
|
protected ExceptionChecker.UncaughtReporter |
reporter
Responsible for creating an appropriate exception. |
protected SubtypeSet |
throwsSet
The throws set, calculated bottom up. |
Fields inherited from class polyglot.visit.ErrorHandlingVisitor |
---|
error, job, nf, ts |
Constructor Summary | |
---|---|
ExceptionChecker(Job job,
TypeSystem ts,
NodeFactory nf)
|
Method Summary | |
---|---|
protected NodeVisitor |
enterCall(Node n)
|
protected NodeVisitor |
enterError(Node n)
This method determines what should be returned by enter()
should its call to enterCall() throw a
SemanticException . |
protected Node |
leaveCall(Node old,
Node n,
NodeVisitor v)
Call exceptionCheck(ExceptionChecker) on the node. |
ExceptionChecker |
pop()
|
ExceptionChecker |
push()
|
ExceptionChecker |
push(java.util.Collection catchableTypes)
|
ExceptionChecker |
push(ExceptionChecker.UncaughtReporter reporter)
|
ExceptionChecker |
push(Type catchableType)
|
ExceptionChecker |
pushCatchAllThrowable()
|
protected void |
reportUncaughtException(Type t,
Position pos)
|
void |
throwsException(Type t,
Position pos)
The ast nodes will use this callback to notify us that they throw an exception of type t. |
SubtypeSet |
throwsSet()
|
Methods inherited from class polyglot.visit.ErrorHandlingVisitor |
---|
begin, catchErrors, enter, enterCall, errorQueue, hasErrors, job, leave, leaveCall, leaveCall, nodeFactory, typeSystem |
Methods inherited from class polyglot.visit.HaltingVisitor |
---|
bypass, bypass, bypassChildren, override, visitChildren |
Methods inherited from class polyglot.visit.NodeVisitor |
---|
copy, enter, finish, finish, leave, override, toString, visitEdge, visitEdgeNoOverride |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ExceptionChecker outer
protected java.util.Set catchable
protected SubtypeSet throwsSet
protected ExceptionChecker.UncaughtReporter reporter
protected boolean catchAllThrowable
Constructor Detail |
---|
public ExceptionChecker(Job job, TypeSystem ts, NodeFactory nf)
Method Detail |
---|
public ExceptionChecker push(ExceptionChecker.UncaughtReporter reporter)
public ExceptionChecker push(Type catchableType)
public ExceptionChecker push(java.util.Collection catchableTypes)
public ExceptionChecker pushCatchAllThrowable()
public ExceptionChecker push()
public ExceptionChecker pop()
protected NodeVisitor enterCall(Node n) throws SemanticException
enterCall
in class ErrorHandlingVisitor
SemanticException
protected NodeVisitor enterError(Node n)
ErrorHandlingVisitor
enter()
should its call to enterCall()
throw a
SemanticException
.
enterError
in class ErrorHandlingVisitor
n
- The root of the subtree that was traversed.
ErrorHandlingVisitor
which should be
used to visit the childre of n
.protected Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException
leaveCall
in class ErrorHandlingVisitor
old
- The original state of root of the current subtree.n
- The current state of the root of the current subtree.v
- The NodeVisitor
object used to visit the children.
n
.
SemanticException
public void throwsException(Type t, Position pos) throws SemanticException
t
- The type of exception that the node throws.
SemanticException
public SubtypeSet throwsSet()
protected void reportUncaughtException(Type t, Position pos) throws SemanticException
SemanticException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |