Review request for 6795561

irisg at alum.mit.edu irisg at alum.mit.edu
Tue Apr 7 01:10:27 UTC 2009


Hi, Alan.

Sorry it took me so long to get to this.  I needed to carve out some time
so that I could think about your changes and review a few things on 
bugs.sun.com.

> From: Alan Bateman
> Sent: Tuesday, March 24, 2009 1:48 AM
> To: core-libs-dev
> Subject: Review request for 6795561
> 
> 6795561: (bf) CharBuffer.subSequence() uses wrong capacity value for new 
> buffer
> 
> Iris, you might want to review this one. 
> CharBuffer#subSequence(start,end) is specified to return a char buffer 
> that has a position of position() + start, a limit of position() + end,
> and a capacity of capacity(). For buffers created via 
> CharBuffer#allocate or char buffer views we've always generated code 
> that return a CharBuffer with a position of 0 and a limit and capacity 
> that is the length of the subsequence. To my knowledge this hasn't been
> noticed, probably because it required casting the result to a char 
> buffer.

I think that this behavior was noticed.  See this specification bug:

  4511104 (bf spec) CharBuffer.subSequence() specification incorrect

> The webrev is here:
>   http://cr.openjdk.java.net/~alanb/6795561/webrev.00/

Given the unfortunate bug history of this method, I think that your 
approach is the way to go.  I also agree with your evaluation to let
the change bake in jdk7 then backport to an appropriate 6uX release.  

I approve.  Given that your update will address the problem described 
in 4511104, I suggest that you provide a minor update to that 
evaluation then close it as duplicate of 6795561.

Fantastic bit of work!  Let's hope CharBuffer.subSequence() is finally
a happy method.

iris





More information about the core-libs-dev mailing list