Java Reference
In-Depth Information
function
subsumes
L
ater
C
atches
(
exceptionType
,
Catching
cn
)
returns
Boolean
if
null
then return
false
else
cn
=
if
(
exceptionType
,
cn
.
catchIdDecl
.
type
)
then return
(
true
)
else
return
subsumes
assignable
(
exceptionType
,
cn
.
more
)
L
ater
C
atches
end
procedure
(SetOfType
throwsSet
,Catching
cn
)
f ilteredThrowsSet
← filter
process
C
atch
T
hrows
(
throwsSet
,
cn
.
catchIdDecl
.
type
)
if
f ilteredThrowsSet
=
throwsSet
then call
error
(”
No throws reach this catch
”)
else
if
cn
.
more
null
then call
process
C
atch
(
f ilteredThrowsSet
,
cn
.
more
)
end
function
filter
T
hrows
( SetOfType
throwsSet
,
exceptionType
)
returns
SetO f Type
ans
←∅
foreach
t
∈
throwsSet
do
if not
assignable
(
exceptionType
,
t
)
then
ans
←
ans
∪
t
return
(
ans
)
end
function
filter
C
atches
(SetOfType
throwsSet
,
Catching
cn
)
returns
SetO f Type
if
null
then return
filter
cn
.
more
=
(
throwsSet
,
cn
.
catchIdDecl
.
type
)
T
hrows
else
return
filter
,
cn
.
more
)
C
atches
(
filter
T
hrows
(
throwsSet
,
cn
.
catchIdDecl
.
type
)
end
procedure
update
C
atch
L
ist
(Catching
cn
)
call
extend
C
atch
L
ist
(
cn
.
catchIdDecl
.
type
)
if
null
then call
update
cn
.
more
C
atch
L
ist
(
cn
.
more
)
end
Figure 9.27: Utility Semantic Methods for Try and Throw Statements