Another issue in JLS8 section 16.2.15
Hiram Hunt
hiramhunt at verizon.net
Wed Jun 15 13:48:20 UTC 2022
Hello,
I think I see another issue in JLS8 section 16.2.15.
The phrase
– V is definitely unassigned after every assert
statement that occurs in the try block.
occurs in two locations in 16.2.15 as part of a determination
of whether V is definitely unassigned before a later block.
The first case is for before catch blocks and the second case
is for before the finally block. The problem is that even
if V is definitely unassigned after the assert, V could
still be assigned if the assert completes abruptly and this
execution path will lead to a catch block (maybe) and
to any finally block. The assignment could occur in either
expression of the two expression form of assert.
I have not carefully tried every combination of one and
two expression asserts and try, catch and finally blocks, but
javac did prevent double assignment in the cases I checked.
-- Hiram Hunt (hiramhunt at verizon.net)
More information about the jls-jvms-spec-comments
mailing list