Wayne,

Many thanks for the reply.

ImagePlus implementing AutoCloseable is certainly not a show stopper.

I had thought ImageJ's attachment to the antiquity of Java 1.6 had already
been abandoned.

Is ImageJ for ever to be denied making use of new language/JVM features?

Not a criticism, I understand the importance of long term stability and
compatibility.

As always, thank you for your reply.

-- Michael Ellis

On Fri, 22 Mar 2024, 02:57 Wayne Rasband, <[email protected]> wrote:

> > 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to