jsr370-experts@jax-rs-spec.java.net

Proposal for small API change: Make MessageBodyWriter.getSize a default method

From: Markus KARG <markus_at_headcrashing.eu>
Date: Thu, 4 Feb 2016 19:39:49 +0100

Experts,

 

I'd like to propose a late but very tiny API change and I hope you all agree
with me. :-)

 

As JAX-RS 2.1 targets Java 8, we can get rid of the useless
MessageBodyWrite.getSize method in implementations if we simply turn it into
a default method in the API which returns -1 always. By doing this real
no-brainener in the API, all MessageBodyWriter implementation classes can
simply omit that method completey. In the end, cases like this are what Java
8 default methods are really good for. :-)

 

I think this is such simple, easy and risk-free that we really should do it!

 

-Markus