Proposal: Automatic Resource Management

Stephen Colebourne scolebourne at joda.org
Wed Mar 4 15:54:49 PST 2009


 > interface Disposable {
 > 	void close() throws Exception;
 > }
 > interface Destroyable {
 > 	void dispose() throws Exception;
 > }
 > interface Kloseable {
 > 	void destroy() throws Exception;
 > }

Er, no. If its to be an interface it needs to be just one.

A single interface - Disposable defining close() covers most use cases, 
and API writers would adapt in the future.

> public finally void release() { ... }

I think this works well, and opens up more options. Are there any 
specific grammer objections?

It would be possible to add a marker interface Finally which enforces 
the presence of the finally modifier, but that seems to have little 
obvious benefit, and be a bit magical.

Stephen



More information about the coin-dev mailing list