[9] RFR of 8065556: (bf) Buffer.position and other methods should include detail in IAE

Alexey Utkin alexey.utkin at gmail.com
Thu Apr 23 17:31:18 UTC 2015


IMHO

http://cr.openjdk.java.net/~bpb/8065556/webrev.04/src/java.base/share/classes/java/nio/Buffer.java.frames.html
{code}
272         if (newPosition > limit | newPosition < 0)
273             throw createPositionOutOfBoundsException(newPosition);
=================================================================
326         if (newLimit > capacity | newLimit < 0)
327             throw createLimitOutOfBoundsException(newLimit);
{code}

is not good code style.

Regards,
-uta

On Thu, Apr 23, 2015 at 7:38 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
>
> On 21/04/2015 23:22, Brian Burkhalter wrote:
>
> Another iteration of this patch has been posted at
>
> http://cr.openjdk.java.net/~bpb/8065556/webrev.04/
>
> to be reviewed at your convenience.
>
> Summary:
>
> 1) Exception creation methods renamed for consistency to
> createXYZException().
> 2) Methods in #1 still create and return an IAE but leave throwing it to the
> caller.
> 3) Static methods in #1 moved up below constructors for style consistency.
> 4) Line lengths adjusted in tests to be within conventional limits.
>
> The approach looks okay to me. It would have been interesting to have done
> micro benchmarks to see it matches Martin's observation/bug as that was news
> to me.
>
> In Buffer then it would be nice to reduce the method names a bit so that the
> declarations don't spill over two lines. I realize it's just nit picking but
> it's good to keep the code consistent when you can.
>
> The test update looks okay now.
>
> -Alan


More information about the nio-dev mailing list