AutoCloseable XMLStreamReader and XMLStreamWriter?

Alan Bateman Alan.Bateman at oracle.com
Mon May 27 08:40:40 UTC 2013


On 26/05/2013 12:04, Philippe Marschall wrote:
> Hi
>
> It would be nice if javax.xml.stream.XMLStreamReader and 
> javax.xml.stream.XMLStreamWriter could be made to extend 
> java.lang.AutoCloseable so that they can be used in a 
> try-with-resouces statement. The some does for XMLEventReader and 
> XMLEventReader.
I don't recall if this one has come up before (there were lots of 
candidates identified for retrofitting when AutoCloseable was added) but 
the XML APIs have the complication that they are a "Standalone 
Technology". I don't know how far back JSR-206/173 needs to be support 
but if you retrofit these interfaces to extend AutoCloseable then it 
would rule out usage with jdk6. Joe Wang might know about about this.

-Alan



More information about the core-libs-dev mailing list