Proposal: Automatic Resource Management
Joshua Bloch
jjb at google.com
Wed Mar 4 15:17:28 PST 2009
Tim,
Hi!
On Wed, Mar 4, 2009 at 2:40 PM, Tim Peierls <tim at peierls.net> wrote:
> I've never understood the fervor with which Java is defended from
> annotations that can change program semantics; the defenders' arguments
> always sound suspiciously circular. But never mind that ... I confess that
> even though I would have been happy with
>
> @Finally public void release() { ... }
>
> I'd much prefer
>
> public finally void release() { ... }
>
I think it's worth adding this to the proposal as a design alternative. The
finally modifier could appear on one and only one method. It would have to
be a public, parameterless instance method. This would require a (small)
class file format change, and a change to the JavaDoc tool, which would
document that the class was a "resource," and which method was its disposal
method. It would make the automatic resource management statement a bit
more broadly applicable at the expense of a bit of added complexity.
Josh
>
More information about the coin-dev
mailing list