It is true that both try-with-resources and AutoCloseable are Java 7 features, however Closeable has been around forever and is completely backwards compatible.
I’m glad to hear that it is coming in 2.1, though :)
On Oct 2, 2014, at 5:12 AM, Santiago Pericas-Geertsen <Santiago.PericasGeertsen_at_oracle.com> wrote:
> Steven,
>
> That's because try-with-resources and AutoClosable are SE 7 and JAX-RS 2.0 runs on SE 6. JAX-RS 2.1, upcoming in EE 8, will be able to take advantage of these new features.
>
> -- Santiago
>
> On Oct 1, 2014, at 6:18 PM, Steven Schlansker <stevenschlansker_at_gmail.com> wrote:
>
>> Hi jax-rs users,
>>
>> I am curious why Response does not implement Closeable.
>> That would allow all sorts of neat uses, in particular
>> try-with-resources:
>>
>> try (Response resp = httpClient.target(…).get()) {
>> // use resp
>> } // resp closed!
>>
>> It may seem like a very small issue, but does impact
>> usability in a non-trivial way.
>>
>> I didn’t see a clear answer on the mailing list.
>> Hopefully someone can clarify.
>>
>> Thanks!
>> Steven
>>
>