Proposal: Automatic Resource Management (original) (raw)
Roel Spilker r.spilker at gmail.com
Mon Mar 9 17:17:31 PDT 2009
- Previous message: Proposal: Automatic Resource Management
- Next message: Proposal: Automatic Resource Management
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Josh,
Another benefit of the AutoClosable interface is that static code analyzers, such as findbugs and Eclipse, could find AutoClosable instances that are never closed if they are used outside ARM blocks and don't escape out of the method, or if they are accessed after close has been called.
SWT has an abstract class Resource that is the base class of all OS-dependent system resources, like Color, Cursor, Font, Image etc. The contract states you have to call dispose on them manually to release the resource to the OS again. It would be trivial for the SWT developers to retrofit the Resource class to implement the AutoClosable interface so the application programmer can benefit from the ARM blocks.
Roel
- Previous message: Proposal: Automatic Resource Management
- Next message: Proposal: Automatic Resource Management
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]