> On Mar 19, 2024, at 7:22 AM, Michael Ellis <[email protected]> wrote:
>
> Would it be useful for ImagePlus to implement AutoClosable so it could be
> used with Java's try with resources syntax?
It might be useful but the downside is some ImageJ users still use Java 1.6 and
the AutoCloseable interface requires Jave 1.7 or later.
-wayne
> Of course, the behaviour can be implemented by subclassing ImagePlus:
>
> class ImagePlusAC extends ImagePlus implements AutoCloseable {
>
> public ImagePlusAC(String title, Image image) {
> super(title, image);
> }
>
> // And the other constructors
> }
>
> And that works nicely... but... I cannot see any obvious downside to
> ImagePlus just being tagged as AutoClosable.
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html