Right: (with or without closures) there is no guarantee that any particular method completes normally unless it is specified to do so.<br><br><div class="gmail_quote">On Sun, Nov 16, 2008 at 3:44 PM, Vladimir Kirichenko <span dir="ltr"><<a href="mailto:vladimir.kirichenko@gmail.com">vladimir.kirichenko@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Neal Gafter wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All of the examples I've seen where you could get into this kind of "trouble" involve making locally obvious errors. The exception points you precisely to where you made the mistake, too. In this case the temp() method clearly constructs a closure that should not escape its scope (it has a return in it) yet is assigned to a static variable.<br>
</blockquote>
<br></div>
The main point was to show that after the<br>
<br>
unrestrictedClosure.invoke()<br>
<br>
there are to guaranty that the following statements will execute.<br>
<br>
so there will be no exception but the code will not be executed:<br>
<br>
void m ({int ===> void} t) {<br>
<br>
t.invoke(i);<br>
<br>
System.out.println("who knows if we ever get here...");<br>
<br>
}<br>
<br>
Doesn't it look strange?<br>
<br>
-- <br>
Best Regards,<br><font color="#888888">
Vladimir Kirichenko<br>
<br>
</font></blockquote></div><br>