Java Reference
In-Depth Information
class ThrowsVisitor extends NodeVisitor
procedure
gather
T
hrows
( n )
9
call
visit
C
hildren
( n )
ans ←∅
foreach c n . getChildren() do ans ans c . throwsSet
n . throwsSet ans
end
procedure
visit
( IfTesting ifn )
10
call gather
T
hrows
( ifn )
end
procedure
visit
(WhileLooping wn )
11
call
gather
T
hrows
( wn )
end
procedure
visit
(DoWhileLooping dwn )
12
call
gather
T
hrows
( dwn )
end
procedure
visit
(ForLooping fn )
13
call gather
T
hrows
( fn )
end
procedure
visit
( LabeledStmt ls )
14
call
gather
T
hrows
( ls )
end
procedure
(Continuing cn )
cn . throwsSet ←∅
visit
15
end
procedure
(Breaking bn )
bn . throwsSet ←∅
visit
16
end
procedure
visit
(Returning rn )
17
call gather
T
hrows
( rn )
end
procedure
visit
(Switching sn )
18
call
gather
T
hrows
( sn )
end
procedure
visit
(CaseItem cn )
19
call
gather
T
hrows
( cn )
end
procedure
visit
( LabelList lln )
20
/
Constant-valued expressions cannot throw exceptions
/
lln . throwsSet ←∅
end
end
Figure 9.4: Throws Analysis Visitors (Part 1)
 
Search WWH ::




Custom Search