Paul Sandoz paul.sandoz at
Mon Sep 28 10:01:13 UTC 2015

Hi Sven,

Your intuition is right, you need to modify associated templates e.g.:


The best thing to do is pick an existing method common to all buffers (such as the existing slice method), work out how it is implemented and then copy the pattern. Looking at the generated source will also help, especially from an IDE, where you can see what generated classes implement and overrides e.g see:


There is likely a similar pattern to follow for the tests.


> On 26 Sep 2015, at 18:41, Sven Reimers <sven.reimers at> wrote:
> Hi all,
> what would it take to get JDK-5071718 into 9?
> I thought about something like this;
> /**
> Creates a new byte buffer whose content is a shared subsequence of this
> buffer's content.
> The content of the new buffer will start at the given position. The
> capacity and limit of the new buffer will be the given length. Changes to
> this buffer's content will be visible in the new buffer, and vice versa;
> the two buffers' position, limit, and mark values will be independent.
> The new buffer's position will be zero, and its mark will be undefined. The
> new buffer will be direct if, and only if, this buffer is direct, and it
> will be read-only if, and only if, this buffer is read-only.
> Returns:The new byte buffer
> **/
> public abstract ByteBuffer slice(int start, int length)
> Probably should emit some exception in case start or start+length are
> greater than the underlying buffer length. Any further ideas for required
> checks?
> Seems I need to modify the templates to get this distributed to all the
> variants existing - not only ByteBuffer.
> Anyone able to guide me and help me get this through - I am willing to
> provide implementation and tests if I know where to look for obstacles and
> challenges?
> Thanks
> Sven
> --
> Sven Reimers
> * Senior Expert Software Architect
> * Java Champion
> * NetBeans Dream Team Member:
> * Community Leader  NetBeans:
>                              Desktop Java:
> * JUG Leader JUG Bodensee:
> * Duke's Choice Award Winner 2009
> * Blog:

More information about the core-libs-dev mailing list